Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: applications API writing to unavailable models

SierraJC00c93aa8b078
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php
index 6094276e08..782a23a894 100644
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@ -938,12 +938,12 @@ class ApplicationsController extends Controller
$application->environment_id = $environment->id;
$application->source_type = $githubApp->getMorphClass();
$application->source_id = $githubApp->id;
+ $application->save();
+ $application->refresh();
if (isset($useBuildServer)) {
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- $application->save();
- $application->refresh();
if (! $application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
@@ -1034,12 +1034,12 @@ class ApplicationsController extends Controller
$application->destination_id = $destination->id;
$application->destination_type = $destination->getMorphClass();
$application->environment_id = $environment->id;
+ $application->save();
+ $application->refresh();
if (isset($useBuildServer)) {
$application->settings->is_build_server_enabled = $useBuildServer;
$application->settings->save();
}
- $application->save();
- $application->refresh();
if (! $application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
@@ -1120,15 +1120,16 @@ class ApplicationsController extends Controller
$application->destination_id = $destination->id;
$application->destination_type = $destination->getMorphClass();
$application->environment_id = $environment->id;
- if (isset($useBuildServer)) {
- $application->settings->is_build_server_enabled = $useBuildServer;
- $application->settings->save();
- }
+
$application->git_repository = 'coollabsio/coolify';
$application->git_branch = 'main';
$application->save();
$application->refresh();
+ if (isset($useBuildServer)) {
+ $application->settings->is_build_server_enabled = $useBuildServer;
+ $application->settings->save();
+ }
if (! $application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
@@ -1184,15 +1185,15 @@ class ApplicationsController extends Controller
$application->destination_id = $destination->id;
$application->destination_type = $destination->getMorphClass();
$application->environment_id = $environment->id;
- if (isset($useBuildServer)) {
- $application->settings->is_build_server_enabled = $useBuildServer;
- $application->settings->save();
- }
-
+
$application->git_repository = 'coollabsio/coolify';
$application->git_branch = 'main';
$application->save();
$application->refresh();
+ if (isset($useBuildServer)) {
+ $application->settings->is_build_server_enabled = $useBuildServer;
+ $application->settings->save();
+ }
if (! $application->settings->is_container_label_readonly_enabled) {
$application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n");
$application->save();
diff --git a/openapi.json b/openapi.json
index 5d35331ec6..95fd95730a 100644
--- a/openapi.json
+++ b/openapi.json
@@ -342,8 +342,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
@@ -659,8 +671,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
@@ -976,8 +1000,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
@@ -1222,8 +1258,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
@@ -1451,8 +1499,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
@@ -1533,8 +1593,20 @@
}
},
"responses": {
- "200": {
- "description": "Application created successfully."
+ "201": {
+ "description": "Application created successfully.",
+ "content": {
+ "application\/json": {
+ "schema": {
+ "properties": {
+ "uuid": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
"401": {
"$ref": "#\/components\/responses\/401"
diff --git a/openapi.yaml b/openapi.yaml
index 20bf348730..a027a62968 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -246,8 +246,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':
@@ -475,8 +481,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':
@@ -704,8 +716,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':
@@ -880,8 +898,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':
@@ -1047,8 +1071,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':
@@ -1105,8 +1135,14 @@ paths:
description: 'Use build server.'
type: object
responses:
- '200':
+ '201':
description: 'Application created successfully.'
+ content:
+ application/json:
+ schema:
+ properties:
+ uuid: { type: string }
+ type: object
'401':
$ref: '#/components/responses/401'
'400':