-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathapi.v1.runs.$runId.metadata.ts
More file actions
29 lines (24 loc) · 858 Bytes
/
api.v1.runs.$runId.metadata.ts
File metadata and controls
29 lines (24 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { json } from "@remix-run/server-runtime";
import { UpdateMetadataRequestBody } from "@trigger.dev/core/v3";
import { z } from "zod";
import { updateMetadataService } from "~/services/metadata/updateMetadata.server";
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
const ParamsSchema = z.object({
runId: z.string(),
});
const { action } = createActionApiRoute(
{
params: ParamsSchema,
body: UpdateMetadataRequestBody,
maxContentLength: 1024 * 1024 * 2, // 3MB
method: "PUT",
},
async ({ authentication, body, params }) => {
const result = await updateMetadataService.call(params.runId, body, authentication.environment);
if (!result) {
return json({ error: "Task Run not found" }, { status: 404 });
}
return json(result, { status: 200 });
}
);
export { action };