Skip to content

backend feature api pet-adoption#96

Open
nikkybel wants to merge 2 commits intoamina69:mainfrom
nikkybel:pet-adoption
Open

backend feature api pet-adoption#96
nikkybel wants to merge 2 commits intoamina69:mainfrom
nikkybel:pet-adoption

Conversation

@nikkybel
Copy link
Copy Markdown

PR: Pet Status Lifecycle Implementation

close #36

Overview

This PR implements the Pet Status Lifecycle feature, enforcing a state machine for pet status transitions throughout the adoption and custody process. It ensures that pets can only move between valid states, maintaining data integrity and preventing invalid transitions.

Features

  • State Machine for Pet Status:
    • Enforces valid transitions: AVAILABLE → PENDING → ADOPTED, AVAILABLE → IN_CUSTODY → AVAILABLE, etc.
    • Blocks invalid transitions (e.g., ADOPTED → PENDING, IN_CUSTODY → ADOPTED).
    • Allows admin override for ADOPTED → AVAILABLE (return scenario).
  • Transition Validation:
    • Centralized validator for all status changes.
    • Throws clear errors for invalid transitions.
    • Logs all status changes for audit trail.
  • API Endpoints:
    • PATCH /pets/:id/status: Update pet status with validation and audit logging.
    • GET /pets/:id/transitions: Get allowed transitions and current status for a pet.
    • GET /pets/:id/transitions/allowed: Get allowed transitions for the current user (role-aware).
  • Swagger Documentation:
    • All endpoints are fully documented and visible in Swagger UI.
    • Request/response schemas and examples included.
  • Test Coverage:
    • Unit tests for all valid and invalid transitions.
    • Tests for admin overrides and edge cases.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@nikkybel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 26, 2026

@nikkybel test failed

@nikkybel
Copy link
Copy Markdown
Author

@amina69 fixed

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Mar 31, 2026

@nikkybel still failing

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.

Queue Dashboard

2 participants