feat: add gateway registration and org-proxy initialization

This commit is contained in:
Sheen Capadngan
2025-08-27 04:36:17 +08:00
parent cc34b92d56
commit ae62c59382
19 changed files with 944 additions and 20 deletions
@@ -0,0 +1,29 @@
import z from "zod";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
export const registerGatewayV2Router = async (server: FastifyZodProvider) => {
server.route({
method: "POST",
url: "/",
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),
schema: {
body: z.object({
proxyName: z.string()
}),
response: {
200: z.any()
}
},
handler: async (req) => {
const gateway = await server.services.gatewayV2.registerGateway({
orgId: req.permission.orgId,
proxyName: req.body.proxyName,
actorId: req.permission.id
});
return gateway;
}
});
};