refactor(cloud): add deploy to external API

This commit is contained in:
Mauricio Siu
2024-10-04 18:53:46 -06:00
parent 3df2f8e58c
commit 5cebf5540a
10 changed files with 92 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import {
startServiceRemote,
stopService,
stopServiceRemote,
findProjectById,
} from "@dokploy/builders";
export const mysqlRouter = createTRPCRouter({
@@ -36,6 +37,13 @@ export const mysqlRouter = createTRPCRouter({
if (ctx.user.rol === "user") {
await checkServiceAccess(ctx.user.authId, input.projectId, "create");
}
const project = await findProjectById(input.projectId);
if (project.adminId !== ctx.user.adminId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not authorized to access this project",
});
}
const newMysql = await createMysql(input);
if (ctx.user.rol === "user") {