add openapi registers

This commit is contained in:
miloschwartz 2025-04-06 22:44:14 -04:00
parent a76e3e00f7
commit d260450a84
No known key found for this signature in database
50 changed files with 852 additions and 60 deletions

View file

@ -12,6 +12,7 @@ import { addPeer } from "../gerbil/peers";
import { addTargets } from "../newt/targets";
import { pickPort } from "./helpers";
import { isTargetValid } from "@server/lib/validators";
import { OpenAPITags, registry } from "@server/openApi";
const updateTargetParamsSchema = z
.object({
@ -31,6 +32,24 @@ const updateTargetBodySchema = z
message: "At least one field must be provided for update"
});
registry.registerPath({
method: "post",
path: "/target/{targetId}",
description: "Update a target.",
tags: [OpenAPITags.Target],
request: {
params: updateTargetParamsSchema,
body: {
content: {
"application/json": {
schema: updateTargetBodySchema
}
}
}
},
responses: {}
});
export async function updateTarget(
req: Request,
res: Response,