aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server/services/index.ts
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-10-18 22:22:55 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-10-18 22:22:55 +0200
commit4efed80a2f8dc238b420eadf97d56c3eccaadb76 (patch)
tree7732a80745622c097a9e75dfb056603bceb10a23 /src/lib/server/services/index.ts
parent0685e9ece66fbcb09c9457027cf7bb2107cc0171 (diff)
refactor: inject the database into every servicemain
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.
Diffstat (limited to 'src/lib/server/services/index.ts')
-rw-r--r--src/lib/server/services/index.ts8
1 files changed, 8 insertions, 0 deletions
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);