Skip to content

feat: implement adoption completion upon escrow release (Issue #62)#93

Merged
amina69 merged 3 commits intoamina69:mainfrom
Miracle656:issue-62-adoption-completion
Feb 27, 2026
Merged

feat: implement adoption completion upon escrow release (Issue #62)#93
amina69 merged 3 commits intoamina69:mainfrom
Miracle656:issue-62-adoption-completion

Conversation

@Miracle656
Copy link
Copy Markdown
Contributor

Description

Closes #62

This PR introduces the logic to automatically mark an adoption as completed when its associated escrow funds have been released. It updates both the adoption status and pet ownership securely within a transaction while logging the state changes for telemetry tracking.

Changes Included

  • Escrow Service: Added releaseEscrow method that:
    • Updates the Escrow status to RELEASED.
    • Automatically updates the attached Adoption status to COMPLETED.
    • Updates the Pet status to ADOPTED and transfers currentOwnerId to the adopter.
    • Generates verifiable system events (ESCROW_RELEASED & ADOPTION_COMPLETED).
  • Escrow Module: Registered EventsModule to give EscrowService access to event logging.
  • Testing: Added comprehensive unit tests within escrow.service.spec.ts for strictly isolating and validating the release escrow logic and its subsequent effect on the Adoption entity. Also resolved missing strict null checks in pets.e2e-spec.ts.

Verification Steps

  1. Run npm run test or jest src/escrow to verify the new coverage over the escrow completion logic.
  2. Verified backend TypeScript compiler passes (npm run build).

Screenshots / Notes

All logic is contained within Prisma transactions to prevent data inconsistency during exceptions.

@amina69
Copy link
Copy Markdown
Owner

amina69 commented Feb 26, 2026

@Miracle656 conflct needed fix

@amina69 amina69 merged commit 92d6f52 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.

Adoption Completion Logic

2 participants