forked from Lilly-Protocol/lily-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagents.routes.ts
More file actions
28 lines (24 loc) · 829 Bytes
/
Copy pathagents.routes.ts
File metadata and controls
28 lines (24 loc) · 829 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
import { Router } from "express";
import { apiKeyAuth } from "../../common/http/api-key-auth.middleware";
import { idempotencyKeyMiddleware } from "../../common/http/idempotency.middleware";
import { validateBody } from "../../common/http/validate.middleware";
import {
createAgent,
deleteAgent,
getAgentById,
listAgents,
updateAgentStatus,
} from "./agents.controller";
import { agentStatusSchema, createAgentSchema } from "./agents.schema";
export const agentsRouter = Router();
agentsRouter.use(apiKeyAuth);
agentsRouter.get("/", listAgents);
agentsRouter.get("/:id", getAgentById);
agentsRouter.post(
"/",
idempotencyKeyMiddleware,
validateBody(createAgentSchema),
createAgent,
);
agentsRouter.patch("/:id", validateBody(agentStatusSchema), updateAgentStatus);
agentsRouter.delete("/:id", deleteAgent);