Skip to content

Made a little harmless changes - #303

Open
Aboyeji-Isaac wants to merge 1 commit into
SwiftChainn:mainfrom
Aboyeji-Isaac:fix/42-login-validation
Open

Aboyeji-Isaac wants to merge 1 commit into
SwiftChainn:mainfrom
Aboyeji-Isaac:fix/42-login-validation

Conversation

@Aboyeji-Isaac

Copy link
Copy Markdown
Contributor

Summary

Provide a concise description of the change and the motivation.

Related Issue

Closes #248
Closes #249
Closes #250
Closes #281

What I changed

  • Added Escrow, Dispute and AuditLog Mongoose models
  • Implemented a DisputeService with lock and resolution logic
  • Added DisputeController and versioned routes under /api/v1/disputes
  • Added audit logging for admin actions

Files of interest

  • src/models/Escrow.ts
  • src/models/Dispute.ts
  • src/models/AuditLog.ts
  • src/services/disputeService.ts
  • src/controllers/disputeController.ts
  • src/routes/disputeRoutes.ts
  • src/routes/index.ts

How to test locally

  1. Ensure .env contains a working MONGODB_URI (or run MongoDB locally).
  2. Install dependencies:
pnpm install
  1. Run tests:
pnpm test
  1. Start the dev server:
pnpm run dev
  1. Example API calls (adjust host/port if needed):

Lock an escrow (admin):

curl -X POST http://localhost:3000/api/v1/disputes/<ESCROW_ID>/lock \
  -H "Content-Type: application/json" \
  -d '{"adminId":"<ADMIN_USER_ID>", "reason":"Buyer reports damaged goods"}'

Resolve a dispute (refund or release):

curl -X POST http://localhost:3000/api/v1/disputes/<DISPUTE_ID>/resolve \
  -H "Content-Type: application/json" \
  -d '{"adminId":"<ADMIN_USER_ID>", "action":"refund", "notes":"Refund approved"}'

Fetch dispute details:

curl http://localhost:3000/api/v1/disputes/<DISPUTE_ID>

Acceptance Criteria Mapping

  • Controller -> Service -> Model architecture: implemented
  • Persistence: data saved to MongoDB; no hardcoded mocks
  • API Versioning: endpoints registered under /api/v1
  • Robust error handling: service and controller validate inputs and return errors

Checklist

Proof of Work

Attach a screenshot of successful API response or test output. Example: terminal output of pnpm test or a Postman request showing success.

Notes for reviewers

  • This PR adds new models and routes; ensure DB indices and migration steps are acceptable.
  • Admin authorization is not enforced in this change — recommend adding RBAC middleware in a follow-up.

@Tybravo

Tybravo commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

@Aboyeji-Isaac

Please complete your tasks so, I can review and merge

Thanks

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

Labels

None yet

Projects

None yet

2 participants