Inject application database contexts

This commit is contained in:
Julian Appel 2026-07-26 12:30:42 +02:00
parent 859fa4a42a
commit d7b98de56a
26 changed files with 201 additions and 63 deletions

View file

@ -1,13 +1,17 @@
import { and, eq } from "drizzle-orm";
import { db } from "../client.js";
import type { AppDatabase } from "../database-context.js";
import { circuitLists } from "../schema/circuit-lists.js";
export class CircuitListRepository {
constructor(private readonly database: AppDatabase) {}
async listByProject(projectId: string) {
const db = this.database;
return db.select().from(circuitLists).where(eq(circuitLists.projectId, projectId));
}
async findById(projectId: string, circuitListId: string) {
const db = this.database;
const [row] = await db
.select()
.from(circuitLists)