Skip to content

Implement delivery status update API with authentication and validation#64

Open
GiftedGiftB wants to merge 1 commit into
SwiftChainn:mainfrom
GiftedGiftB:ImplementDeliveryStatusUpdateAPI
Open

Implement delivery status update API with authentication and validation#64
GiftedGiftB wants to merge 1 commit into
SwiftChainn:mainfrom
GiftedGiftB:ImplementDeliveryStatusUpdateAPI

Conversation

@GiftedGiftB

Copy link
Copy Markdown

close #19

Summary

Implemented the delivery status update API for SwiftChain_Backend with a strict layered architecture:

  • ControllerServiceModel
  • PUT /api/v1/deliveries/:id/status
  • Validates status updates and enforces allowed transitions
  • Enforces JWT-based authorization for driver and admin roles

What changed

  • Added delivery schema and model: deliveryModel.ts
  • Added status transition validation service: deliveryService.ts
  • Added controller endpoint handler: deliveryController.ts
  • Added authorization middleware: auth.ts
  • Added route registration: deliveries.ts
  • Integrated route into API versioning: index.ts
  • Added reusable HTTP error helper: httpError.ts

API behavior

  • Accepts payload: { "status": "assigned" }
  • Supports transitions:
    • pendingassigned
    • assignedpicked_up
    • picked_upin_transit
    • in_transitdelivered
  • Rejects invalid status values and invalid transitions
  • Returns persisted delivery object from MongoDB

Tests

  • Added integration-style coverage: deliveryStatusUpdate.test.ts
  • Verified:
    • missing auth returns 401
    • valid transition succeeds
    • invalid transition returns 400
  • Existing health check remains passing

Validation

  • pnpm test --runInBand
  • pnpm exec tsc --noEmit

Notes

  • Branch: ImplementDeliveryStatusUpdateAPI
  • Ready for review and merge
  • Suggested issue reference: Closes #19

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@GiftedGiftB Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend: Implement Delivery Status Update API

1 participant