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

@@ -9,6 +9,7 @@ import createHttpError from "http-errors";
import logger from "@server/logger";
import { fromError } from "zod-validation-error";
import stoi from "@server/lib/stoi";
import { OpenAPITags, registry } from "@server/openApi";
const addUserRoleParamsSchema = z
.object({
@@ -19,6 +20,17 @@ const addUserRoleParamsSchema = z
export type AddUserRoleResponse = z.infer<typeof addUserRoleParamsSchema>;
registry.registerPath({
method: "post",
path: "/role/{roleId}/add/{userId}",
description: "Add a role to a user.",
tags: [OpenAPITags.Role, OpenAPITags.User],
request: {
params: addUserRoleParamsSchema
},
responses: {}
});
export async function addUserRole(
req: Request,
res: Response,