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

Function createGitlab

packages/server/src/services/gitlab.ts:13–46  ·  view source on GitHub ↗
(
	input: z.infer<typeof apiCreateGitlab>,
	organizationId: string,
	userId: string,
)

Source from the content-addressed store, hash-verified

11export type Gitlab = typeof gitlab.$inferSelect;
12
13export const createGitlab = async (
14 input: z.infer<typeof apiCreateGitlab>,
15 organizationId: string,
16 userId: string,
17) => {
18 return await db.transaction(async (tx) => {
19 const newGitProvider = await tx
20 .insert(gitProvider)
21 .values({
22 providerType: "gitlab",
23 organizationId: organizationId,
24 name: input.name,
25 userId: userId,
26 })
27 .returning()
28 .then((response) => response[0]);
29
30 if (!newGitProvider) {
31 throw new TRPCError({
32 code: "BAD_REQUEST",
33 message: "Error creating the Git provider",
34 });
35 }
36
37 await tx
38 .insert(gitlab)
39 .values({
40 ...input,
41 gitProviderId: newGitProvider?.gitProviderId,
42 })
43 .returning()
44 .then((response) => response[0]);
45 });
46};
47
48export const findGitlabById = async (gitlabId: string) => {
49 const gitlabProviderResult = await db.query.gitlab.findFirst({

Callers 1

gitlab.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected