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

Function createSecurity

packages/server/src/services/security.ts:26–58  ·  view source on GitHub ↗
(
	data: z.infer<typeof apiCreateSecurity>,
)

Source from the content-addressed store, hash-verified

24};
25
26export const createSecurity = async (
27 data: z.infer<typeof apiCreateSecurity>,
28) => {
29 try {
30 await db.transaction(async (tx) => {
31 const application = await findApplicationById(data.applicationId);
32
33 const securityResponse = await tx
34 .insert(security)
35 .values({
36 ...data,
37 })
38 .returning()
39 .then((res) => res[0]);
40
41 if (!securityResponse) {
42 throw new TRPCError({
43 code: "BAD_REQUEST",
44 message: "Error creating the security",
45 });
46 }
47 await createSecurityMiddleware(application, securityResponse);
48 return true;
49 });
50 } catch (error) {
51 throw new TRPCError({
52 code: "BAD_REQUEST",
53 message:
54 error instanceof Error ? error.message : "Error creating this security",
55 cause: error,
56 });
57 }
58};
59
60export const deleteSecurityById = async (securityId: string) => {
61 try {

Callers 2

security.tsFile · 0.90
duplicateServiceFunction · 0.90

Calls 2

findApplicationByIdFunction · 0.90
createSecurityMiddlewareFunction · 0.90

Tested by

no test coverage detected