Skip to content

feat(adoptions): add role-based adoption listing endpoint#75

Closed
anoncon wants to merge 3 commits intoamina69:mainfrom
anoncon:feat/list-adoption-requests-21
Closed

feat(adoptions): add role-based adoption listing endpoint#75
anoncon wants to merge 3 commits intoamina69:mainfrom
anoncon:feat/list-adoption-requests-21

Conversation

@anoncon
Copy link
Copy Markdown

@anoncon anoncon commented Feb 25, 2026

Description

Implements GET /adoptions with role-based visibility and optional filters.

  • USER sees only their own adoption requests (adopterId = currentUserId)
  • SHELTER sees requests for pets they own (pet.currentOwnerId = currentUserId)
  • ADMIN sees all adoption requests
  • Supports optional query filters:
    • status (e.g. PENDING)
    • petId
  • Orders results by newest first (createdAt desc)
  • Returns response as { data: [...] } with:
    • adoption fields (id, status, reason, createdAt)
    • pet fields (id, name, species, imageUrl, images)
    • user fields (id, name, email) without sensitive fields
  • Added Swagger docs for auth + query params
  • Added unit tests for role filtering, optional filters, empty result, and invalid role handling

Files Changed

  • src/adoption/adoption.controller.ts
  • src/adoption/adoption.module.ts
  • src/adoption/adoption.service.ts
  • src/adoption/dto/filter-adoptions.dto.ts
  • src/adoption/adoption.service.spec.ts

Notes

  • GET /adoptions is protected by JwtAuthGuard
  • Empty results return [] inside data (not 404)

Closes #21

@anoncon
Copy link
Copy Markdown
Author

anoncon commented Feb 25, 2026

@amina69 please review my PR

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Feb 25, 2026

@anoncon , kindly resolve the little conflict

@anoncon
Copy link
Copy Markdown
Author

anoncon commented Feb 27, 2026

@amina69 it is possible to merge it i resolve the conflicts

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Feb 27, 2026

@anoncon , yes no conflict, but the cicd pipeline failed, i cant merge, kindly check

@anoncon anoncon closed this Mar 31, 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.

List Adoption Requests

3 participants