feat: gateway registration + start of gateway v2 integration

This commit is contained in:
Sheen Capadngan
2025-08-30 05:51:07 +08:00
parent 2fb13463bc
commit 81dfcb5de1
16 changed files with 577 additions and 130 deletions
+23 -3
View File
@@ -7,23 +7,43 @@ export const registerGatewayV2Router = async (server: FastifyZodProvider) => {
server.route({
method: "POST",
url: "/",
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),
schema: {
body: z.object({
proxyName: z.string()
proxyName: z.string(),
name: z.string()
}),
response: {
200: z.any()
}
},
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
const gateway = await server.services.gatewayV2.registerGateway({
orgId: req.permission.orgId,
proxyName: req.body.proxyName,
actorId: req.permission.id
actorId: req.permission.id,
name: req.body.name
});
return gateway;
}
});
server.route({
method: "GET",
url: "/",
schema: {
response: {
200: z.any()
}
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
const gateways = await server.services.gatewayV2.listGateways({
orgPermission: req.permission
});
return gateways;
}
});
};