diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.php index 6a00818aa..ec3d036bc 100644 --- a/app/Http/Controllers/Api/ServicesController.php +++ b/app/Http/Controllers/Api/ServicesController.php @@ -105,98 +105,7 @@ public function services(Request $request) type: 'object', required: ['server_uuid', 'project_uuid', 'environment_name', 'environment_uuid'], properties: [ - 'type' => [ - 'description' => 'The one-click service type', - 'type' => 'string', - 'enum' => [ - 'activepieces', - 'appsmith', - 'appwrite', - 'authentik', - 'babybuddy', - 'budge', - 'changedetection', - 'chatwoot', - 'classicpress-with-mariadb', - 'classicpress-with-mysql', - 'classicpress-without-database', - 'cloudflared', - 'code-server', - 'dashboard', - 'directus', - 'directus-with-postgresql', - 'docker-registry', - 'docuseal', - 'docuseal-with-postgres', - 'dokuwiki', - 'duplicati', - 'emby', - 'embystat', - 'fider', - 'filebrowser', - 'firefly', - 'formbricks', - 'ghost', - 'gitea', - 'gitea-with-mariadb', - 'gitea-with-mysql', - 'gitea-with-postgresql', - 'glance', - 'glances', - 'glitchtip', - 'grafana', - 'grafana-with-postgresql', - 'grocy', - 'heimdall', - 'homepage', - 'jellyfin', - 'kuzzle', - 'listmonk', - 'logto', - 'mediawiki', - 'meilisearch', - 'metabase', - 'metube', - 'minio', - 'moodle', - 'n8n', - 'n8n-with-postgresql', - 'next-image-transformation', - 'nextcloud', - 'nocodb', - 'odoo', - 'openblocks', - 'pairdrop', - 'penpot', - 'phpmyadmin', - 'pocketbase', - 'posthog', - 'reactive-resume', - 'rocketchat', - 'shlink', - 'slash', - 'snapdrop', - 'statusnook', - 'stirling-pdf', - 'supabase', - 'syncthing', - 'tolgee', - 'trigger', - 'trigger-with-external-database', - 'twenty', - 'umami', - 'unleash-with-postgresql', - 'unleash-without-database', - 'uptime-kuma', - 'vaultwarden', - 'vikunja', - 'weblate', - 'whoogle', - 'wordpress-with-mariadb', - 'wordpress-with-mysql', - 'wordpress-without-database', - ], - ], + 'type' => ['description' => 'The one-click service type (e.g. "actualbudget", "calibre-web", "gitea-with-mysql" ...)', 'type' => 'string'], 'name' => ['type' => 'string', 'maxLength' => 255, 'description' => 'Name of the service.'], 'description' => ['type' => 'string', 'nullable' => true, 'description' => 'Description of the service.'], 'project_uuid' => ['type' => 'string', 'description' => 'Project UUID.'], @@ -283,6 +192,13 @@ public function create_service(Request $request) 'errors' => $errors, ], 422); } + + if (filled($request->type) && filled($request->docker_compose_raw)) { + return response()->json([ + 'message' => 'You cannot provide both service type and docker_compose_raw. Use one or the other.', + ], 422); + } + $environmentUuid = $request->environment_uuid; $environmentName = $request->environment_name; if (blank($environmentUuid) && blank($environmentName)) { @@ -524,8 +440,11 @@ public function create_service(Request $request) 'uuid' => $service->uuid, 'domains' => $domains, ])->setStatusCode(201); - } else { - return response()->json(['message' => 'No service type or docker_compose_raw provided.'], 400); + } elseif (filled($request->type)) { + return response()->json([ + 'message' => 'Invalid service type.', + 'valid_service_types' => $serviceKeys, + ], 404); } }