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

Function resolveServicePath

packages/server/src/services/deployment.ts:47–78  ·  view source on GitHub ↗
(
	orgId: string,
	data: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

45export type ServicePath = { href: string | null; label: string };
46
47export async function resolveServicePath(
48 orgId: string,
49 data: Record<string, unknown>,
50): Promise<ServicePath> {
51 try {
52 const applicationId = data?.applicationId as string | undefined;
53 const composeId = data?.composeId as string | undefined;
54 if (applicationId) {
55 const app = await findApplicationById(applicationId);
56 if (app.environment.project.organizationId !== orgId) {
57 return { href: null, label: "Application" };
58 }
59 return {
60 href: `/dashboard/project/${app.environment.project.projectId}/environment/${app.environment.environmentId}/services/application/${app.applicationId}`,
61 label: "Application",
62 };
63 }
64 if (composeId) {
65 const comp = await findComposeById(composeId);
66 if (comp.environment.project.organizationId !== orgId) {
67 return { href: null, label: "Compose" };
68 }
69 return {
70 href: `/dashboard/project/${comp.environment.project.projectId}/environment/${comp.environment.environmentId}/services/compose/${comp.composeId}`,
71 label: "Compose",
72 };
73 }
74 } catch {
75 // not found or unauthorized
76 }
77 return { href: null, label: "—" };
78}
79
80export type Deployment = typeof deployments.$inferSelect;
81

Callers 1

deployment.tsFile · 0.90

Calls 2

findApplicationByIdFunction · 0.90
findComposeByIdFunction · 0.90

Tested by

no test coverage detected