Skip to content

feat(kyc): add admin KYC review endpoints - #1

Open
tech-adrian wants to merge 4 commits into
mainfrom
fix/1337-admin-kyc-endpoints
Open

feat(kyc): add admin KYC review endpoints#1
tech-adrian wants to merge 4 commits into
mainfrom
fix/1337-admin-kyc-endpoints

Conversation

@tech-adrian

Copy link
Copy Markdown
Owner

Summary

  • Adds a reason column on kyc (migration) to persist rejection/review notes
  • Adds AdminKycController (/admin/kyc/pending, /admin/kyc/rejected, /admin/kyc/:id, /admin/kyc/:id/approve, /admin/kyc/:id/reject) matching the frontend's expected routes, guarded by JWT + admin roles
  • Adds KycService admin methods: paginated listing by status, detail lookup, and approve/reject with idempotent no-ops when already in the target status
  • Wires audit logging and user notifications on approve/reject decisions

Test plan

  • npx jest src/modules/kyc — 7 suites, 104 tests passing
  • npx tsc --noEmit — clean
  • npx eslint src/modules/kyc — clean
  • New admin-kyc.controller.spec.ts covers 403 access control for non-admins and idempotency of repeated approve/reject calls

Admin approve/reject decisions need somewhere to store the reviewer's
note, which the frontend already expects on KycVerification.reason.
…g KYC

Closes chioma-housing-protocol-I#1337

KycService had no admin-facing operations, so the KYC review queue had
nothing to call. Adds paginated pending/rejected listing (joined with
basic user info), a detail lookup, and approve/reject with audit
logging, user notification, and status sync via UserKycStatusService.

Approve/reject are idempotent: re-approving an already-approved record
(or re-rejecting an already-rejected one) returns the current state
without duplicating status transitions, audit entries, or
notifications.
…outes

Closes chioma-housing-protocol-I#1337

Adds AdminKycController at /admin/kyc, guarded by JwtAuthGuard +
RolesGuard (ADMIN/SUPER_ADMIN only), exposing:
  GET  /admin/kyc/pending
  GET  /admin/kyc/rejected
  GET  /admin/kyc/:id
  POST /admin/kyc/:id/approve
  POST /admin/kyc/:id/reject

These match the routes frontend/lib/query/hooks/use-kyc-verifications.ts
already calls, so the existing admin KYC pages become functional without
any frontend changes.
Closes chioma-housing-protocol-I#1337

- admin-kyc.controller.spec.ts: non-admins get 403 on every admin/kyc
  route; admins can list pending/rejected, fetch detail, approve, and
  reject.
- kyc.service.spec.ts: approve/reject notify the user and audit-log the
  transition; re-approving an already-approved record (and re-rejecting
  an already-rejected one) is a no-op that doesn't re-fire the status
  change, audit entry, or notification.
- Existing KycService test modules (kyc.service.spec.ts,
  kyc-encryption.integration.spec.ts, kyc-verification.e2e-spec.ts) now
  provide the User repository KycService needs for admin user lookups.
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.

1 participant