add openapi registers

This commit is contained in:
miloschwartz
2025-04-06 22:44:14 -04:00
parent a76e3e00f7
commit d260450a84
50 changed files with 852 additions and 60 deletions

View File

@@ -14,6 +14,7 @@ import { hashPassword } from "@server/auth/password";
import { fromError } from "zod-validation-error";
import { sendEmail } from "@server/emails";
import SendInviteLink from "@server/emails/templates/SendInviteLink";
import { OpenAPITags, registry } from "@server/openApi";
const inviteUserParamsSchema = z
.object({
@@ -42,6 +43,24 @@ export type InviteUserResponse = {
const inviteTracker: Record<string, { timestamps: number[] }> = {};
registry.registerPath({
method: "post",
path: "/org/{orgId}/create-invite",
description: "Invite a user to join an organization.",
tags: [OpenAPITags.Org],
request: {
params: inviteUserParamsSchema,
body: {
content: {
"application/json": {
schema: inviteUserBodySchema
}
}
}
},
responses: {}
});
export async function inviteUser(
req: Request,
res: Response,