Skip to content

feat: add admin approve/reject adoption endpoints with validation and…#102

Closed
Babigdk wants to merge 3 commits into
amina69:mainfrom
Babigdk:feat/admin-approve-reject-adoption
Closed

feat: add admin approve/reject adoption endpoints with validation and…#102
Babigdk wants to merge 3 commits into
amina69:mainfrom
Babigdk:feat/admin-approve-reject-adoption

Conversation

@Babigdk
Copy link
Copy Markdown

@Babigdk Babigdk commented Apr 2, 2026

Closes #22

🚀 Admin Approval & Rejection for Adoptions

📋 Overview

This PR introduces admin-controlled approval and rejection of adoption requests.


✅ Features Implemented

1. Approve Adoption

  • Endpoint: PATCH /adoption/:id/approve
  • Only accessible by ADMIN
  • Validates adoption is PENDING
  • Updates status → APPROVED
  • Returns updated adoption with relations

2. Reject Adoption

  • Endpoint: PATCH /adoption/:id/reject
  • Only accessible by ADMIN
  • Validates adoption is PENDING
  • Updates status → REJECTED
  • Accepts optional rejection reason
  • Uses Prisma transaction for safety

🔒 Validation & Authorization

  • ADMIN role required (JwtAuthGuard + RolesGuard)
  • Prevents invalid transitions (non-PENDING)
  • Returns:
    • 404 if not found
    • 400 if invalid state
    • 403 if unauthorized

⚠️ Notes

  • No schema changes were made (as required)
  • approvedAt and pet status updates were not implemented due to schema limitations

🧪 Testing

  • Approval flow tested (success + failure cases)
  • Rejection flow tested (with/without reason)
  • Authorization checks verified

📦 Files Changed

  • adoption.controller.ts
  • adoption.service.ts
  • dto/reject-adoption.dto.ts

✅ Status

Ready for review 🚀

@Babigdk
Copy link
Copy Markdown
Author

Babigdk commented Apr 3, 2026

Hi I have created a new pull request for this assigned issue kindly merge. Thanks

niraj56465

This comment was marked as low quality.

Copy link
Copy Markdown
Author

@Babigdk Babigdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solution Applied

@Babigdk
Copy link
Copy Markdown
Author

Babigdk commented May 1, 2026

@niraj56465 @amina69 Kindly merge to main

@Babigdk Babigdk requested a review from niraj56465 May 2, 2026 19:44
@Babigdk
Copy link
Copy Markdown
Author

Babigdk commented May 5, 2026

@niraj56465 that's how it went at discord when I open a ticket for this PR.

Hey <@1149839281788030987>, thanks for reaching out.

We’ve reviewed this, and unfortunately we can’t issue points at this time as there are still outstanding concerns around whether the linked PR fully resolves the issue.

Please follow up with the maintainer directly on GitHub and work with them on resolving/closing this out properly.

Maintainers still have until the end of the week to review and merge eligible PRs.

We’ll go ahead and close out this ticket now. Please feel free to open a new one if something else comes up.

@Babigdk
Copy link
Copy Markdown
Author

Babigdk commented May 5, 2026

Let's make it work 💪

@amina69 amina69 closed this May 27, 2026
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.

Admin Approval

3 participants