Skip to content

feat: richer recurrence options + recurring template editing#45

Merged
AgustinSV merged 5 commits into
mainfrom
feat/recurring-events
Jun 9, 2026
Merged

feat: richer recurrence options + recurring template editing#45
AgustinSV merged 5 commits into
mainfrom
feat/recurring-events

Conversation

@AgustinSV

Copy link
Copy Markdown
Collaborator

Description

Extends the recurring event system with richer schedule options and the ability to edit active templates.
Schema additions (recurring_events table — migration 0031):

days_of_week (integer[]) — selected days for weekly/biweekly patterns
weekdays_only (boolean) — daily events skip weekends when true
monthly_type (varchar) — "day-of-month" or "nth-weekday"
monthly_nth (integer) — which occurrence (1–4, -1 = Last)
monthly_weekday (integer) — weekday for nth-weekday monthly patterns

Cron logic (/api/cron/recurring-events): rewrote occursOnDate() to handle all four frequency types with the new fields. Legacy records with null daysOfWeek fall back to the template's start date day-of-week.
Creation form (RecurringEventCreationForm): UI for all new schedule options — multi-day toggle group for weekly, biweekly single-day select, monthly radio (day-of-month vs. nth-weekday) with corresponding dropdowns. Form now also supports edit mode via an initialValues prop, with immutable fields (frequency, schedule, location, times) shown disabled.
API (/api/recurring-events): added PUT handler for editing title, description, capacity, and end date. Validation added for new fields in POST.
Templates list (RecurringEventsClient): replaced flat frequency labels with a human-readable formatRecurrence() summary (e.g. "Weekly on Mo, We, Fr", "Monthly — 2nd Tuesday"). Edit button (navigates to edit page) and Stop button are both hidden for stopped templates.
Edit page (/dashboard/recurring-event/[id]/edit): full-page edit form mirroring the events library edit pattern. Stopped templates redirect away server-side.

Relevant Issues

N/A

How to Test

Run pnpm drizzle-kit generate then pnpm drizzle-kit migrate to apply migration 0031.
Create recurring events with each frequency type and verify the correct schedule description appears in the templates table.
Click the edit icon on an active template — verify immutable fields (frequency, times, location) are disabled and only title/description/capacity/end date save.
Stop a template — verify both the edit and stop buttons disappear and the edit URL redirects back to /dashboard/recurring-event.
POST to /api/cron/recurring-events with a valid x-api-key header and confirm only templates matching today's date pattern generate events.

Miscellaneous Notes

The Netlify cron (schedule: "0 0 * * *") fires at midnight UTC (≈ 8 PM EDT), creating that UTC calendar day's events ~14 hours before the day begins locally. Idempotency check prevents duplicates if the endpoint is called multiple times.
Legacy weekly/biweekly templates with null daysOfWeek continue to work via startDate day-of-week fallback — no backfill needed.
There is a stale .bak file (RecurringEventsClient.tsx.bak) in the recurring-event directory that should be deleted before merging.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thrive Ready Ready Preview, Comment Jun 9, 2026 8:20pm

@AgustinSV AgustinSV merged commit 7eab28b into main Jun 9, 2026
3 checks passed
@AgustinSV AgustinSV deleted the feat/recurring-events branch June 9, 2026 20:23
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