first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import crypto from "node:crypto";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "../client.js";
|
||||
import { projects } from "../schema/projects.js";
|
||||
|
||||
export class ProjectRepository {
|
||||
async list() {
|
||||
return db.select().from(projects);
|
||||
}
|
||||
|
||||
async create(name: string) {
|
||||
const id = crypto.randomUUID();
|
||||
await db.insert(projects).values({ id, name });
|
||||
return { id, name };
|
||||
}
|
||||
|
||||
async delete(projectId: string) {
|
||||
await db.delete(projects).where(eq(projects.id, projectId));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user