Skip to content

feat(vouching): add decline endpoint for pending vouch requests - #109

Open
Obiajulu-gif wants to merge 1 commit into
StepFi-app:mainfrom
Obiajulu-gif:fix/issue-66-decline-vouch-backend
Open

feat(vouching): add decline endpoint for pending vouch requests#109
Obiajulu-gif wants to merge 1 commit into
StepFi-app:mainfrom
Obiajulu-gif:fix/issue-66-decline-vouch-backend

Conversation

@Obiajulu-gif

Copy link
Copy Markdown

Summary

The corresponding frontend fix (StepFi-Web issue #66) needs to persist a mentor's decline action, but no such endpoint actually existed on this API -- vouching.controller.ts only had request/approve/mine/mentor/requests/revoke routes. The issue's premise (the API endpoint exists but was never wired) turned out to be inaccurate; this adds the missing endpoint.

  • VouchStatus.DECLINED enum value
  • DeclineVouchDto (learnerWallet, same shape as ApproveVouchDto)
  • VouchingService.declineVouch(mentorWallet, dto) -- mirrors approveVouch: finds the mentor's pending vouch for the given learner and sets its status to DECLINED. Since getIncomingRequests() already filters on status = PENDING, a declined request naturally stops appearing in the mentor's incoming-requests list -- no query changes needed elsewhere.
  • POST /vouching/decline controller route, mentor-role-gated like approve

Companion frontend PR (wiring Vouch.tsx to this endpoint) is separate, in StepFi-Web.

Test plan

  • Extended vouching.service.spec.ts with declineVouch coverage (happy path + not-found) -- 6/6 passing via npx jest

The frontend (StepFi-Web issue StepFi-app#66) needs to persist a mentor's decline
action, but no such endpoint existed on this API — vouching.controller.ts
only had request/approve/mine/mentor/requests/revoke. Added:

- VouchStatus.DECLINED enum value
- DeclineVouchDto (learnerWallet, same shape as ApproveVouchDto)
- VouchingService.declineVouch(mentorWallet, dto) — mirrors approveVouch:
  finds the mentor's pending vouch for the given learner, sets status to
  DECLINED. Since getIncomingRequests() already filters on
  status = PENDING, a declined request naturally stops appearing in the
  mentor's incoming-requests list with no further query changes needed.
- POST /vouching/decline controller route, mentor-role-gated like approve

Tests: extended vouching.service.spec.ts with declineVouch coverage
(happy path + not-found). Verified: 6/6 passing (npx jest).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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