From 18a0f9c874aaa09c0f71252dad853c23f9511ed6 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Mon, 7 Sep 2026 11:32:41 +0200 Subject: 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). --- src/routes/+page.server.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/routes/+page.server.ts (limited to 'src/routes/+page.server.ts') 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 }; + }, +}; -- cgit v1.3