added sprint db queries

This commit is contained in:
Oliver Bryan
2026-01-12 01:05:37 +00:00
parent e53bba06d0
commit 5e8a2eeff8
2 changed files with 28 additions and 0 deletions

View File

@@ -2,5 +2,6 @@ export * from "./issues";
export * from "./organisations";
export * from "./projects";
export * from "./sessions";
export * from "./sprints";
export * from "./timed-sessions";
export * from "./users";

View File

@@ -0,0 +1,27 @@
import { Sprint } from "@issue/shared";
import { eq } from "drizzle-orm";
import { db } from "../client";
export async function createSprint(
projectId: number,
name: string,
color: string | undefined,
startDate: Date,
endDate: Date,
) {
const [sprint] = await db
.insert(Sprint)
.values({
projectId,
name,
...(color ? { color } : {}),
startDate,
endDate,
})
.returning();
return sprint;
}
export async function getSprintsByProject(projectId: number) {
return await db.select().from(Sprint).where(eq(Sprint.projectId, projectId));
}