Files
Checkmate/server/openapi/routes/statusPage.ts
Alex Hollidayandgorkem-bwl 3f9019f34c move openapi out of src dir
Adapted from #3579 by @gorkem-bwl. The openapi/registry, helpers, and
per-resource routes/* files are largely their work; this commit relocates
the directory out of src/ so the build-time generator code is not emitted
into dist/, and shifts spec generation from runtime to a build step.

Co-authored-by: gorkem-bwl <gorkem.cetin@bluewavelabs.ca>
2026-05-01 11:31:48 -07:00

53 lines
1.6 KiB
TypeScript

import { registry } from "../registry.js";
import { bearer, multipart, okJsonNoData, okUnknown, standardErrors } from "../helpers.js";
import { createStatusPageBodyValidation, getStatusPageParamValidation, getStatusPageQueryValidation } from "@/validation/statusPageValidation.js";
const tags = ["status-page"];
registry.registerPath({
method: "get",
path: "/status-page/team",
tags,
summary: "List status pages for the caller's team",
security: bearer,
responses: { "200": okUnknown, ...standardErrors },
});
registry.registerPath({
method: "post",
path: "/status-page",
tags,
summary: "Create a status page (logo upload optional)",
security: bearer,
request: { body: { content: multipart(createStatusPageBodyValidation.shape, "logo") } },
responses: { "200": okUnknown, ...standardErrors },
});
registry.registerPath({
method: "put",
path: "/status-page/{id}",
tags,
summary: "Update a status page (logo upload optional)",
security: bearer,
request: { body: { content: multipart(createStatusPageBodyValidation.shape, "logo") } },
responses: { "200": okUnknown, ...standardErrors },
});
registry.registerPath({
method: "get",
path: "/status-page/{url}",
tags,
summary: "Get a public status page by its URL slug",
request: { params: getStatusPageParamValidation, query: getStatusPageQueryValidation },
responses: { "200": okUnknown, "404": { description: "Status page not found" }, "500": standardErrors["500"] },
});
registry.registerPath({
method: "delete",
path: "/status-page/{id}",
tags,
summary: "Delete a status page",
security: bearer,
responses: { "200": okJsonNoData(), ...standardErrors },
});