diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-07 11:32:41 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-07 11:32:41 +0200 |
| commit | 18a0f9c874aaa09c0f71252dad853c23f9511ed6 (patch) | |
| tree | 93103b83f6d0057c40f0bab9c9473bf04292e9c4 /src/routes/+page.server.ts | |
| parent | 113415ce357a9cea1759d0452ebae6352f8fe36b (diff) | |
Add projects with routines, urgency tracking and health scores
Projects group recurring routines (chores included) with an append-only
snapshot table (id, version) so edits never rewrite history; completions
reference the exact snapshot. Pure metrics compute due dates, urgency
buckets (ok/due/late/veryLate) and 0-100 health scores per routine,
project, and globally. Home page lists projects; project dashboard sorts
routines most-urgent first with one-tap completion and interval parser
inputs (1d/2w/3m/1y).
Diffstat (limited to 'src/routes/+page.server.ts')
| -rw-r--r-- | src/routes/+page.server.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts new file mode 100644 index 0000000..fc160df --- /dev/null +++ b/src/routes/+page.server.ts @@ -0,0 +1,20 @@ +import { fail } from '@sveltejs/kit'; +import { loadOverview } from '$lib/server/services/routines'; +import { add as addProject } from '$lib/server/services/projects'; +import { parseFormString } from '$lib/server/services/validation'; +import type { Actions, PageServerLoad } from './$types'; + +export const load: PageServerLoad = async () => { + return loadOverview(Date.now()); +}; + +export const actions: Actions = { + addProject: async ({ request }) => { + const name = parseFormString((await request.formData()).get('name')); + if (!name) { + return fail(400, { error: 'Le nom est requis' }); + } + await addProject(name); + return { success: true }; + }, +}; |
