fix: remove duplicate getService, fix project uuid check for services

Made-with: Cursor
This commit is contained in:
2026-04-23 17:09:00 -07:00
parent 040f0c6256
commit 5d4936346e
2 changed files with 4 additions and 7 deletions

View File

@@ -49,7 +49,6 @@ import {
listAllServices, listAllServices,
listServiceEnvs, listServiceEnvs,
upsertServiceEnv, upsertServiceEnv,
type ServiceEnvVar,
updateApplication, updateApplication,
deleteApplication, deleteApplication,
setApplicationDomains, setApplicationDomains,
@@ -446,8 +445,10 @@ async function toolAppsDeploy(principal: Principal, params: Record<string, any>)
try { try {
const svc = await getService(appUuid); const svc = await getService(appUuid);
// Verify it belongs to this workspace's project // Verify it belongs to this workspace's project
const proj = (svc.project as Record<string, unknown> | undefined); const svcProjectUuid = svc.project_uuid
if (proj?.uuid !== projectUuid) { ?? svc.environment?.project_uuid
?? svc.environment?.project?.uuid;
if (svcProjectUuid !== projectUuid) {
return NextResponse.json({ error: 'Service not found in this workspace' }, { status: 404 }); return NextResponse.json({ error: 'Service not found in this workspace' }, { status: 404 });
} }
await startService(appUuid); await startService(appUuid);

View File

@@ -556,10 +556,6 @@ export async function stopService(uuid: string): Promise<void> {
await coolifyFetch(`/services/${uuid}/stop`, { method: 'POST' }); await coolifyFetch(`/services/${uuid}/stop`, { method: 'POST' });
} }
export async function getService(uuid: string): Promise<Record<string, unknown>> {
return coolifyFetch(`/services/${uuid}`);
}
export interface ServiceEnvVar { key: string; value: string; is_preview?: boolean; is_literal?: boolean; } export interface ServiceEnvVar { key: string; value: string; is_preview?: boolean; is_literal?: boolean; }
export async function listServiceEnvs(uuid: string): Promise<ServiceEnvVar[]> { export async function listServiceEnvs(uuid: string): Promise<ServiceEnvVar[]> {