feat: add deployable option to randomize and prevent colission in duplicate templates

This commit is contained in:
Mauricio Siu
2025-02-03 00:57:18 -06:00
parent 97b77e526d
commit 6f2148c060
13 changed files with 4872 additions and 6 deletions

View File

@@ -46,6 +46,7 @@ import {
findServerById,
loadServices,
randomizeComposeFile,
randomizeDeployableComposeFile,
removeCompose,
removeComposeDirectory,
removeDeploymentsByComposeId,
@@ -216,6 +217,21 @@ export const composeRouter = createTRPCRouter({
}
return await randomizeComposeFile(input.composeId, input.suffix);
}),
randomizeDeployableCompose: protectedProcedure
.input(apiRandomizeCompose)
.mutation(async ({ input, ctx }) => {
const compose = await findComposeById(input.composeId);
if (compose.project.adminId !== ctx.user.adminId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not authorized to randomize this compose",
});
}
return await randomizeDeployableComposeFile(
input.composeId,
input.suffix,
);
}),
getConvertedCompose: protectedProcedure
.input(apiFindCompose)
.query(async ({ input, ctx }) => {