Skip to content

MSPCA-67 Add scheduled jobs to update pet and children ages - #39

Open
Juwang110 wants to merge 14 commits into
mainfrom
jw/mspca-67-age-jobs
Open

Juwang110 wants to merge 14 commits into
mainfrom
jw/mspca-67-age-jobs

Conversation

@Juwang110

@Juwang110 Juwang110 commented Nov 22, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes MSPCA-67

Stacked on #34 (MSPCA-56). Once #34 merges, the base switches to main.

📝 Description

Pet ages (years and months) and children's ages (years) are stored as plain numbers, so they go stale. Two scheduled jobs now keep them current.

  1. Monthly pet job: adds a month to every pet. A pet at 11 months rolls into the next year at month 0, so age_month never reaches 12.
  2. Yearly children job: adds a year to every child of every volunteer with hasChildren: true.
  3. Wiring: AgeJobsService holds the two @Cron methods, which only call PetsService.incrementAllAges() and VolunteersService.incrementAllChildrenAges(). A failed run is logged and doesn't crash the app. ScheduleModule.forRoot() and JobsModule are registered in AppModule.
  4. New dependency: @nestjs/schedule.

✔️ Verification

  • Service tests cover the 11-to-0 rollover, a mixed batch, an empty table, and only volunteers with children being loaded. Job tests cover the cron expressions and time zone and that a failure is swallowed. All 477 backend tests pass, and lint and typecheck are clean.
  • I started the scheduler in a throwaway test (not committed) and confirmed both jobs register, with next runs on 2026-12-01 and 2027-01-01 at midnight Eastern.

🏕️ (Optional) Future Work / Notes

🤖 Generated with Claude Code

Juwang110 and others added 14 commits November 12, 2026 17:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s when hasChildren is turned off

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move PetDto to pets/dtos, document params on the children-rule helpers,
and type the pet fixtures in specs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Juwang110
Juwang110 marked this pull request as ready for review November 22, 2026 18:01
Base automatically changed from jw/mspca-56-volunteer-pets to main November 22, 2026 21:56
@dburkhart07
dburkhart07 requested a review from psmolyan November 22, 2026 23:32
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.

3 participants