68 lines
4 KiB
Text
68 lines
4 KiB
Text
|
|
[2026-10-29 22:54:34 IST] Admin app: open the order from an order-placed push, including cold start.
|
|
|
|
--- apps/admin-ui/services/notif-service/pending-order.ts (new)
|
|
+ Module-level pending order id: setPendingOrderId / takePendingOrderId / clearPendingOrderId.
|
|
--- apps/admin-ui/services/notif-service/notif-context.tsx
|
|
~ Extract openFromNotification(response): numeric-validates data.orderId, dedupes by
|
|
request.identifier, pushes order details when signed in, stashes the id when signed out.
|
|
~ Call it from the response listener AND from Notifications.getLastNotificationResponseAsync()
|
|
(terminated-app tap), then clearLastNotificationResponseAsync().
|
|
~ Wait for StaffAuthProvider hydration (isLoading === false) before handling the launch response.
|
|
--- apps/admin-ui/components/context/staff-auth-context.tsx
|
|
~ On login success, route to a pending order notification target instead of always the dashboard.
|
|
--- apps/admin-ui/tests/mocks/expo-notifications-mock.ts
|
|
+ clearLastNotificationResponseAsync mock; __setLastResponse() to seed the cold-start response.
|
|
--- apps/admin-ui/tests/app/root-layout.test.tsx
|
|
+ AROOT-06 cold-start tap, AROOT-07 duplicate response opened once, AROOT-08 signed-out deferral.
|
|
--- apps/admin-ui/tests/pages/login.test.tsx
|
|
+ ALOGIN-15 pending order target wins over the dashboard after login.
|
|
--- apps/admin-ui/JEST-TEST-CASES.md
|
|
+ Catalogue rows for AROOT-06..08 and ALOGIN-15.
|
|
|
|
[2026-10-29 22:57:48 IST] Admin push notifications for order cancellation and new complaints.
|
|
|
|
--- apps/backend/src/lib/admin-notif.ts
|
|
~ notifyAllAdmins payload gains optional complaintId; forwarded in jobData.
|
|
--- apps/backend/src/lib/notif-job.ts
|
|
~ sendAdminNotification accepts complaintId and includes it in the push data.
|
|
--- apps/backend/src/lib/queue-consumer.ts
|
|
~ forwards jobData.complaintId (null fallback) to sendAdminNotification.
|
|
--- apps/backend/src/lib/post-order-handler.ts
|
|
~ handleOrderCancelled pushes "Order Cancelled" to every admin device with data.orderId.
|
|
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
|
|
~ createComplaint returns the inserted complaint id (was void).
|
|
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
|
|
~ complaint.raise pushes "New Complaint" to admin devices with data.complaintId;
|
|
notification failures are logged and never fail the complaint.
|
|
--- apps/admin-ui/services/notif-service/pending-navigation.ts (renames pending-order.ts)
|
|
~ Holds a pending href instead of an order id, so a signed-out tap on either
|
|
notification type resumes after login.
|
|
--- apps/admin-ui/services/notif-service/notif-context.tsx
|
|
~ Routes data.complaintId to the complaints list (orderId still wins).
|
|
--- apps/admin-ui/components/context/staff-auth-context.tsx
|
|
~ login consumes the pending href.
|
|
--- tests
|
|
~ queue-consumer expectation gains complaintId; admin-ui root-layout/login tests
|
|
updated for the href-based pending target; AROOT-09 complaint tap added.
|
|
|
|
[2026-10-29 23:02:23 IST] Scope admin order/complaint push notifications to the event's region.
|
|
|
|
--- packages/db_helper_sqlite/src/admin-apis/staff-user.ts
|
|
+ getStaffNotifTokensForRegion(regionId): staff_notif_creds inner-joined to
|
|
staff_users where staff_users.region_id = regionId.
|
|
--- packages/db_helper_sqlite/index.ts
|
|
+ export the new helper.
|
|
--- packages/db_helper_sqlite/src/user-apis/order.ts
|
|
~ OrderWithFullData gains regionId (already selected at runtime).
|
|
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
|
|
~ createComplaint returns { id, regionId } instead of a bare id.
|
|
--- apps/backend/src/lib/admin-notif.ts
|
|
+ notifyRegionAdmins(regionId, payload) — refuses null region, otherwise batches
|
|
the region's tokens. notifyAllAdmins kept for manual broadcasts only.
|
|
--- apps/backend/src/lib/post-order-handler.ts
|
|
~ Order placed and order cancelled use notifyRegionAdmins(order.regionId, ...).
|
|
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
|
|
~ complaint.raise uses notifyRegionAdmins(complaint.regionId, ...).
|
|
--- apps/backend/tests/unit/admin-notif.test.ts
|
|
~ Rewritten for region scoping + manual broadcast; asserts null region is a no-op.
|