MCPcopy
hub / github.com/Dokploy/dokploy / createServer

Function createServer

packages/server/src/services/server.ts:15–37  ·  view source on GitHub ↗
(
	input: z.infer<typeof apiCreateServer>,
	organizationId: string,
)

Source from the content-addressed store, hash-verified

13export type Server = typeof server.$inferSelect;
14
15export const createServer = async (
16 input: z.infer<typeof apiCreateServer>,
17 organizationId: string,
18) => {
19 const newServer = await db
20 .insert(server)
21 .values({
22 ...input,
23 organizationId: organizationId,
24 createdAt: new Date().toISOString(),
25 } as typeof server.$inferInsert)
26 .returning()
27 .then((value) => value[0]);
28
29 if (!newServer) {
30 throw new TRPCError({
31 code: "BAD_REQUEST",
32 message: "Error creating the server",
33 });
34 }
35
36 return newServer;
37};
38
39export const findServerById = async (serverId: string) => {
40 const currentServer = await db.query.server.findFirst({

Callers 1

server.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected