The most demanding technical challenge of the MSC platform was the schedules and attendance module. We architected a two-tier system: `DefaultSchedule` acts as the permanent template, while `WeeklySchedule` represents the physical class instance for a specific week. To automate this, a NestJS cron job runs every Saturday at midnight (`@Cron('0 0 * * 6')`) to generate the upcoming week's classes and automatically subscribe eligible athletes. The critical engineering requirement here was *idempotency*. Before creating any records, the job verifies if that specific week has already been generated. This ensures that a server restart or an accidental manual execution by an administrator never results in duplicated classes or overbooked capacities, maintaining absolute data integrity.
June 15, 2026
Idempotency in Automated Scheduling
Tackling the most complex module in the MSC platform: automated weekly class generation.
nestjsbackendcron