Repository navigation
Conversation
Paused: P4 starts later. Migration, repository writes, actor mapping and tests are done; docs and the PR are not. Co-authored-by: Yousef Ahmed Maher <ya1770620@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #217: the order's status history and the staff Order 360 timeline API.
Related issue
Closes #217
Changes made
order-service
order_status_history(migration 009, entity): one append-only row per transition —orderId, from, to, actorType (CUSTOMER/RESTAURANT/DRIVER/SYSTEM/STAFF), actorId, reason, at— written in the same transaction as every status compare-and-set inorders.repository.ts(and the creation row increate), so every applied transition leaves exactly one row. Only the CAS winner writes. Backfill is not possible; documented in the migration and indocs/services/order-service.md.GET /admin/orders/:id(support.read): the full staff view — items and prices, the fee split, the drop-off snapshot, the payment line, without the internal fee-split columns.GET /admin/orders/:id/timeline(support.read): one merged, time-sorted list of{at, source, type, actor, details}from the order history plus three new internal slices. A source that doesn't answer is reported inunavailable, never made up. Internal notes (STAFF_NOTE) arrive with feat: support actions (cancel, refund, re-dispatch, internal notes) #219.historyActorFor): JWT role → actor type; SYSTEM callers carry no person (sub is a service identity); STAFF keeps the admin's id.payment-service —
GET /internal/payments/orders/:orderId/timeline(SYSTEM, caller-checked): every payment attempt with its outcome, and the refund with who asked.delivery-service —
GET /internal/deliveries/orders/:orderId/timeline(SYSTEM): created / assigned (with driver) / picked up / completed / cancelled from the compare-and-set timestamps.notification-service —
GET /internal/notifications/orders/:orderId/timeline(SYSTEM): the stage notifications as types and times only (matched onparams.orderId); no message bodies in staff views.Contract & docs — admin OpenAPI routes added and regenerated (
docs/openapi/admin.json);docs/services/{order,payment,delivery,notification}-service.md, env vars (PAYMENT_SERVICE_URL,DELIVERY_SERVICE_URL,NOTIFICATION_SERVICE_URL) and.project-context/16-current-state.mdupdated in the same PR.Testing performed
npm run verify(lint + all workspace tests + build) passes; 743 tests green.Breaking changes
None. Additive migration (009), additive admin routes, additive internal routes.
Documentation changes
Listed above; all in this PR.
Checklist