frontend server utility improvement

This commit is contained in:
Oliver Bryan
2025-12-31 17:57:55 +00:00
parent c7d261048b
commit 70ef02f790
19 changed files with 381 additions and 182 deletions

View File

@@ -1,14 +0,0 @@
import type { BunRequest } from "bun";
import { getIssuesWithAssigneeByProject, getProjectByKey } from "../../db/queries";
export default async function issuesInProject(req: BunRequest<"/issues/:projectKey">) {
const { projectKey } = req.params;
const project = await getProjectByKey(projectKey);
if (!project) {
return new Response(`project not found: provided ${projectKey}`, { status: 404 });
}
const issues = await getIssuesWithAssigneeByProject(project.id);
return Response.json(issues);
}

View File

@@ -0,0 +1,15 @@
import type { AuthedRequest } from "../../auth/middleware";
import { getIssuesWithAssigneeByProject, getProjectByID } from "../../db/queries";
export default async function issuesByProject(req: AuthedRequest) {
const url = new URL(req.url);
const projectId = url.searchParams.get("projectId");
const project = await getProjectByID(Number(projectId));
if (!project) {
return new Response(`project not found: provided ${projectId}`, { status: 404 });
}
const issues = await getIssuesWithAssigneeByProject(project.id);
return Response.json(issues);
}