-
-
Notifications
You must be signed in to change notification settings - Fork 106
160 recurring expense #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements recurring expense functionality, allowing users to schedule expenses to repeat automatically using cron expressions. The implementation replaces pg-boss with pg_cron for better database-native job scheduling and migrates expense IDs from CUIDs to PostgreSQL UUIDs to support SQL procedures.
- Adds a comprehensive cron builder UI with timezone handling and internationalization
- Implements database schema changes for recurring expenses with pg_cron integration
- Creates a new recurring expenses page and navigation integration
Reviewed Changes
Copilot reviewed 40 out of 43 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/expense.types.ts | Adds recurrenceId field to expense creation type and cronExpression to schema |
| src/store/addStore.ts | Updates expense store with recurring expense fields and improved state management |
| src/server/api/services/splitService.ts | Adds cron job cleanup logic for expense deletion and editing |
| src/server/api/services/scheduleService.ts | Implements recurring expense job creation function |
| src/server/api/routers/expense.ts | Adds recurring expense creation, retrieval, and cron schedule handling |
| src/pages/recurring.tsx | New page displaying user's recurring expenses |
| src/lib/cron.ts | Comprehensive cron expression timezone conversion utilities |
| src/components/ui/cron-builder.tsx | Full-featured cron expression builder component |
| src/components/AddExpense/RecurrenceInput.tsx | Integration component for recurring expense input |
| prisma/schema.prisma | Major schema changes including UUID migration and pg_cron tables |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Closes #160
This is a big one. I didn't really like
pg-bossand opted for a more resilient solution ofpg_cron. We use it anyway for cache cleaning now, so it's better that we do not add another dependency.It is also a bit limiting, so for now balances are not updated in DB, as we will remove them in release 1.6 after all. To further support this decision we already introduce major DB migrations in the form of migrating expense cuids to native PG uuids, which is required for recurring expenses to be insertable using SQL procedures (that pg_cron uses).
The scheduling itself is of course cron based, I spent a lot of time polishing it, but feedback is welcome.
Logic wise, each expense with a defined schedule:
pg_cronjobThere is a new recurrence view at the activity tab.
PLease note that it is not deploy ready yet. We still require #247
@FriesischScott I guess now is the time for us to finish it up if you're still up to it ;)
screenrecording-2025-10-07_21-47-50.mp4