Files
Checkmate/server/openapi/routes/invite.ts
T
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

36 lines
1.2 KiB
TypeScript

import { registry } from "../registry.js";
import { bearer, json, okJson, okJsonNoData, standardErrors } from "../helpers.js";
import { z } from "zod";
import { inviteBodyValidation, inviteVerificationBodyValidation } from "@/validation/authValidation.js";
const tags = ["invite"];
registry.registerPath({
method: "post",
path: "/invite/send",
tags,
summary: "Send an invite email (admin/superadmin)",
security: bearer,
request: { body: { content: json(inviteBodyValidation) } },
responses: { "200": okJsonNoData(), ...standardErrors },
});
registry.registerPath({
method: "post",
path: "/invite/verify",
tags,
summary: "Verify an invite token",
request: { body: { content: json(inviteVerificationBodyValidation) } },
responses: { "200": okJson(z.object({ email: z.string(), role: z.array(z.string()).optional() }).passthrough()), "500": standardErrors["500"] },
});
registry.registerPath({
method: "post",
path: "/invite",
tags,
summary: "Create an invite token (admin/superadmin)",
security: bearer,
request: { body: { content: json(inviteBodyValidation) } },
responses: { "200": okJson(z.object({ token: z.string() }).passthrough()), ...standardErrors },
});