Skip to content

Logging service has been implemented and is saving to prisma database#94

Merged
amina69 merged 5 commits intoamina69:mainfrom
EzeanoroEbuka:main
Feb 27, 2026
Merged

Logging service has been implemented and is saving to prisma database#94
amina69 merged 5 commits intoamina69:mainfrom
EzeanoroEbuka:main

Conversation

@EzeanoroEbuka
Copy link
Copy Markdown
Contributor

PR: Pet Status Lifecycle Implementation (Closes #17)

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.

Acceptance Criteria

  • Valid transitions work as expected.
  • Invalid transitions are blocked with clear error messages.
  • Admin can override certain restrictions.
  • Status changes are logged.
  • All endpoints are documented in Swagger.
  • Unit tests cover all scenarios.

Closes


Please review the implementation and test the endpoints via Swagger UI (/api/docs).

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Feb 26, 2026

@EzeanoroEbuka test is failing

@EzeanoroEbuka
Copy link
Copy Markdown
Contributor Author

I have worked on the tests that are failing

@EzeanoroEbuka
Copy link
Copy Markdown
Contributor Author

I think it can be merged now and closed

@amina69 amina69 merged commit f490a5f into amina69:main Feb 27, 2026
3 checks passed
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.

Pet Status Lifecycle

2 participants