Update error message for missing resources

This commit is contained in:
Andras Bacsai 2024-03-07 12:35:38 +01:00
parent c7f15c42fa
commit 9d31d990fc

View File

@ -99,7 +99,7 @@ public function by_tags(string $tags, int $team_id, bool $force = false)
foreach ($tags as $tag) {
$found_tag = Tag::where(['name' => $tag, 'team_id' => $team_id])->first();
if (!$found_tag) {
$message->push("Tag {$tag} not found.");
// $message->push("Tag {$tag} not found.");
continue;
}
$applications = $found_tag->applications()->get();
@ -120,6 +120,7 @@ public function by_tags(string $tags, int $team_id, bool $force = false)
$message = $message->merge($return_message);
}
}
ray($message);
if ($message->count() > 0) {
$payload->put('message', $message->toArray());
if ($deployments->count() > 0) {
@ -128,7 +129,7 @@ public function by_tags(string $tags, int $team_id, bool $force = false)
return response()->json($payload->toArray(), 200);
}
return response()->json(['error' => "No resources found.", 'docs' => 'https://coolify.io/docs/api/deploy-webhook'], 404);
return response()->json(['error' => "No resources found with this tag.", 'docs' => 'https://coolify.io/docs/api/deploy-webhook'], 404);
}
public function deploy_resource($resource, bool $force = false): array
{