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
@@ -2,6 +2,7 @@ import { db, labels } from "@server/db";
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, ne, sql } from "drizzle-orm";
import { NextFunction, Request, Response } from "express";
@@ -22,6 +23,39 @@ const updateLabelBodySchema = z.strictObject({
.nonempty()
});
registry.registerPath({
method: "patch",
path: "/org/{orgId}/label/{labelId}",
description: "Update a label.",
tags: [OpenAPITags.Label],
request: {
params: paramsSchema,
body: {
content: {
"application/json": {
schema: updateLabelBodySchema
}
}
}
},
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 updateOrgLabel(
req: Request,
res: Response,