max status length of 24

This commit is contained in:
Oliver Bryan
2026-01-10 17:00:39 +00:00
parent 593e155755
commit b315020b37
3 changed files with 65 additions and 24 deletions

View File

@@ -1,3 +1,4 @@
import { ISSUE_STATUS_MAX_LENGTH } from "@issue/shared";
import type { BunRequest } from "bun";
import { getOrganisationById, updateOrganisation } from "../../db/queries";
@@ -20,6 +21,12 @@ export default async function organisationUpdate(req: BunRequest) {
if (statuses.length === 0) {
return new Response("statuses must have at least one status", { status: 400 });
}
if (statuses.some((s) => s.length > ISSUE_STATUS_MAX_LENGTH)) {
return new Response(`status must be <= ${ISSUE_STATUS_MAX_LENGTH} characters`, {
status: 400,
});
}
} catch {
return new Response("invalid statuses format (must be JSON array)", { status: 400 });
}