feat(kyc): add admin KYC review endpoints - #1
Open
tech-adrian wants to merge 4 commits into
Open
Conversation
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.
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
reasoncolumn onkyc(migration) to persist rejection/review notesAdminKycController(/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 rolesKycServiceadmin methods: paginated listing by status, detail lookup, and approve/reject with idempotent no-ops when already in the target statusTest plan
npx jest src/modules/kyc— 7 suites, 104 tests passingnpx tsc --noEmit— cleannpx eslint src/modules/kyc— cleanadmin-kyc.controller.spec.tscovers 403 access control for non-admins and idempotency of repeated approve/reject calls