mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-19 21:05:21 +02:00
refactor(cloud): add validation to prevent create applications without server
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
removePostgresById,
|
||||
updatePostgresById,
|
||||
findProjectById,
|
||||
IS_CLOUD,
|
||||
} from "@dokploy/builders";
|
||||
|
||||
export const postgresRouter = createTRPCRouter({
|
||||
@@ -36,6 +37,13 @@ export const postgresRouter = createTRPCRouter({
|
||||
await checkServiceAccess(ctx.user.authId, input.projectId, "create");
|
||||
}
|
||||
|
||||
if (IS_CLOUD && !input.serverId) {
|
||||
throw new TRPCError({
|
||||
code: "UNAUTHORIZED",
|
||||
message: "You need to use a server to create a postgres",
|
||||
});
|
||||
}
|
||||
|
||||
const project = await findProjectById(input.projectId);
|
||||
if (project.adminId !== ctx.user.adminId) {
|
||||
throw new TRPCError({
|
||||
|
||||
Reference in New Issue
Block a user