MCPcopy Index your code
hub / github.com/Dokploy/dokploy / createCompose

Function createCompose

packages/server/src/services/compose.ts:49–80  ·  view source on GitHub ↗
(
	input: z.infer<typeof apiCreateCompose>,
)

Source from the content-addressed store, hash-verified

47export type Compose = typeof compose.$inferSelect;
48
49export const createCompose = async (
50 input: z.infer<typeof apiCreateCompose>,
51) => {
52 const appName = buildAppName("compose", input.appName);
53
54 const valid = await validUniqueServerAppName(appName);
55 if (!valid) {
56 throw new TRPCError({
57 code: "CONFLICT",
58 message: "Service with this 'AppName' already exists",
59 });
60 }
61
62 const newDestination = await db
63 .insert(compose)
64 .values({
65 ...input,
66 composeFile: input.composeFile || "",
67 appName,
68 })
69 .returning()
70 .then((value) => value[0]);
71
72 if (!newDestination) {
73 throw new TRPCError({
74 code: "BAD_REQUEST",
75 message: "Error input: Inserting compose",
76 });
77 }
78
79 return newDestination;
80};
81
82export const createComposeByTemplate = async (
83 input: typeof compose.$inferInsert,

Callers 3

compose.tsFile · 0.90
duplicateServiceFunction · 0.90
handleImportFunction · 0.85

Calls 2

buildAppNameFunction · 0.90
validUniqueServerAppNameFunction · 0.90

Tested by

no test coverage detected