add get role to integration api

This commit is contained in:
miloschwartz 2025-06-04 17:28:40 -04:00
parent 96b451843c
commit 4593edbb45
No known key found for this signature in database
2 changed files with 19 additions and 0 deletions

View file

@ -280,6 +280,13 @@ authenticated.delete(
role.deleteRole role.deleteRole
); );
authenticated.get(
"/role/:roleId",
verifyApiKeyRoleAccess,
verifyApiKeyHasAction(ActionsEnum.getRole),
role.getRole
);
authenticated.post( authenticated.post(
"/role/:roleId/add/:userId", "/role/:roleId/add/:userId",
verifyApiKeyRoleAccess, verifyApiKeyRoleAccess,

View file

@ -8,6 +8,7 @@ import HttpCode from "@server/types/HttpCode";
import createHttpError from "http-errors"; import createHttpError from "http-errors";
import logger from "@server/logger"; import logger from "@server/logger";
import { fromError } from "zod-validation-error"; import { fromError } from "zod-validation-error";
import { OpenAPITags, registry } from "@server/openApi";
const getRoleSchema = z const getRoleSchema = z
.object({ .object({
@ -15,6 +16,17 @@ const getRoleSchema = z
}) })
.strict(); .strict();
registry.registerPath({
method: "get",
path: "/role/{roleId}",
description: "Get a role.",
tags: [OpenAPITags.Role],
request: {
params: getRoleSchema
},
responses: {}
});
export async function getRole( export async function getRole(
req: Request, req: Request,
res: Response, res: Response,