Skip to content

ALT-14: Implementar flujo de adopcion completo#8

Merged
lapc506 merged 1 commit intomainfrom
ALT-14-adoption-flow
Mar 28, 2026
Merged

ALT-14: Implementar flujo de adopcion completo#8
lapc506 merged 1 commit intomainfrom
ALT-14-adoption-flow

Conversation

@lapc506
Copy link
Copy Markdown
Collaborator

@lapc506 lapc506 commented Mar 28, 2026

Summary

  • Crea AdoptionsModule con listados y solicitudes de adopcion
  • Entidades: AdoptionListing (spatial index, estado DRAFT->ACTIVE->ADOPTED), AdoptionApplication (unique per user+listing, max 3 activas)
  • State machine: publicar, pausar, reactivar, cerrar (con cascada de rechazo)
  • Aprobacion auto-cierra listado y rechaza otras solicitudes
  • 4 nuevos NotificationType para adopciones, integrado con NotificationsModule
  • 15 tests unitarios + 51 existentes = 66 total

Linear Issue

ALT-14

OpenSpec Change

openspec/changes/adoption-flow/ (BE-01 a BE-35)

Files Changed (21)

  • 17 new: enums, entities, DTOs, services, resolvers, module, tests
  • 4 modified: animal.entity.ts (new fields), app.module.ts, notification-type.enum.ts, package.json

Depends On

Test plan

  • Verificar npm run build compila sin errores
  • Verificar 66 tests pasan (15 nuevos)
  • Verificar listing state machine: DRAFT->ACTIVE->PAUSED->ADOPTED/WITHDRAWN
  • Verificar max 1 application per user per listing
  • Verificar max 3 active applications globally
  • Verificar approve cascade: close listing + reject others
  • Verificar push notifications en submit/approve/reject

Created by Claude Code on behalf of @lapc506

🤖 Generated with Claude Code

@linear
Copy link
Copy Markdown

linear bot commented Mar 28, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Warning

Rate limit exceeded

@lapc506 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 46 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 46 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 373f909c-7092-45df-9263-94375c74abcd

📥 Commits

Reviewing files that changed from the base of the PR and between 53c48af and 5f61173.

⛔ Files ignored due to path filters (1)
  • apps/backend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (37)
  • apps/backend/.env.example
  • apps/backend/package.json
  • apps/backend/src/abuse-reports/abuse-reports.module.ts
  • apps/backend/src/abuse-reports/abuse-reports.service.ts
  • apps/backend/src/adoptions/adoption-applications.resolver.ts
  • apps/backend/src/adoptions/adoption-applications.service.spec.ts
  • apps/backend/src/adoptions/adoption-applications.service.ts
  • apps/backend/src/adoptions/adoptions.module.ts
  • apps/backend/src/adoptions/adoptions.resolver.ts
  • apps/backend/src/adoptions/adoptions.service.spec.ts
  • apps/backend/src/adoptions/adoptions.service.ts
  • apps/backend/src/adoptions/dto/adoption-listing-filter.input.ts
  • apps/backend/src/adoptions/dto/create-adoption-listing.input.ts
  • apps/backend/src/adoptions/dto/submit-adoption-application.input.ts
  • apps/backend/src/adoptions/dto/update-adoption-listing.input.ts
  • apps/backend/src/adoptions/entities/adoption-application.entity.ts
  • apps/backend/src/adoptions/entities/adoption-listing.entity.ts
  • apps/backend/src/adoptions/enums/age-category.enum.ts
  • apps/backend/src/adoptions/enums/animal-size.enum.ts
  • apps/backend/src/adoptions/enums/application-status.enum.ts
  • apps/backend/src/adoptions/enums/listing-status.enum.ts
  • apps/backend/src/animals/entities/animal.entity.ts
  • apps/backend/src/app.module.ts
  • apps/backend/src/captures/captures.module.ts
  • apps/backend/src/captures/captures.resolver.ts
  • apps/backend/src/notifications/dto/notification.output.ts
  • apps/backend/src/notifications/dto/register-device-token.input.ts
  • apps/backend/src/notifications/entities/device-token.entity.ts
  • apps/backend/src/notifications/entities/notification.entity.ts
  • apps/backend/src/notifications/enums/device-platform.enum.ts
  • apps/backend/src/notifications/enums/notification-type.enum.ts
  • apps/backend/src/notifications/notifications.module.ts
  • apps/backend/src/notifications/notifications.resolver.ts
  • apps/backend/src/notifications/notifications.service.ts
  • apps/backend/src/notifications/scalars/json.scalar.ts
  • apps/backend/src/subsidies/subsidies.module.ts
  • apps/backend/src/subsidies/subsidies.service.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ALT-14-adoption-flow

Comment @coderabbitai help to get the list of available commands and usage tips.

@lapc506
Copy link
Copy Markdown
Collaborator Author

lapc506 commented Mar 28, 2026

@greptile review

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

… state management

Adds the complete adoption flow backend including:
- AdoptionListing and AdoptionApplication entities with full state machines
- Listing lifecycle: DRAFT -> ACTIVE -> PAUSED -> ADOPTED/WITHDRAWN
- Application lifecycle: SUBMITTED -> IN_REVIEW -> VISIT_SCHEDULED -> VISIT_COMPLETED -> APPROVED/REJECTED
- Publisher validation, max 3 active applications per user, cascading close on approval
- Push notifications via NotificationService for key events
- GraphQL resolvers, DTOs with class-validator, cursor pagination for listings
- New animal fields (size, ageCategory, isSterilized) and READY_FOR_ADOPTION status
- Unit tests for both services covering state transitions, validations, and cascades

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lapc506 lapc506 force-pushed the ALT-14-adoption-flow branch from 5f61173 to 3570f76 Compare March 28, 2026 18:12
@lapc506 lapc506 merged commit 89e6618 into main Mar 28, 2026
Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@lapc506 lapc506 deleted the ALT-14-adoption-flow branch March 28, 2026 18:12
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.

1 participant