From 4efed80a2f8dc238b420eadf97d56c3eccaadb76 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 18 Oct 2026 22:22:55 +0200 Subject: refactor: inject the database into every service Groceries, projects, references and routines become classes holding the Drizzle handle, wired once in services/index.ts alongside categories. Tests build their own instance on an in-memory database. Drops the unused projects.loadAll and projects.rename. --- src/lib/server/services/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/server/services/index.ts') diff --git a/src/lib/server/services/index.ts b/src/lib/server/services/index.ts index 25a05be..372e0d3 100644 --- a/src/lib/server/services/index.ts +++ b/src/lib/server/services/index.ts @@ -1,8 +1,16 @@ import { db } from '$lib/server/db'; import { CategoriesService } from './categories'; +import { GroceriesService } from './groceries'; +import { ProjectsService } from './projects'; +import { ReferencesService } from './references'; +import { RoutinesService } from './routines'; /** * Services wired once for the running server. Tests build their own instances * with a test database instead of importing from here. */ export const categoriesService = new CategoriesService(db); +export const groceriesService = new GroceriesService(db); +export const projectsService = new ProjectsService(db); +export const referencesService = new ReferencesService(db); +export const routinesService = new RoutinesService(db); -- cgit v1.3