Add labels to the integration api

This commit is contained in:
Owen
2026-10-12 16:21:12 -04:00
parent 9afcd68d68
commit e461b231d5
8 changed files with 246 additions and 1 deletions
+34
View File
@@ -9,6 +9,7 @@ import {
import response from "@server/lib/response";
import logger from "@server/logger";
import type { CreateOrEditLabelResponse } from "@server/routers/labels/types";
import { OpenAPITags, registry } from "@server/openApi";
import HttpCode from "@server/types/HttpCode";
import { and, eq, sql } from "drizzle-orm";
import { NextFunction, Request, Response } from "express";
@@ -30,6 +31,39 @@ const bodySchema = z.strictObject({
resourceId: z.number().int().optional()
});
registry.registerPath({
method: "post",
path: "/org/{orgId}/labels",
description: "Create a label in an organization.",
tags: [OpenAPITags.Label],
request: {
params: paramsSchema,
body: {
content: {
"application/json": {
schema: bodySchema
}
}
}
},
responses: {
200: {
description: "Successful response",
content: {
"application/json": {
schema: z.object({
data: z.record(z.string(), z.any()).nullable(),
success: z.boolean(),
error: z.boolean(),
message: z.string(),
status: z.number()
})
}
}
}
}
});
export async function createOrgLabel(
req: Request,
res: Response,