fix: make project template inheritance granular and safe
CI/CD / test_and_check_app (push) Failing after 3m8s
CI/CD / Publish immutable image (push) Skipped
CI/CD / test_and_check_app (pull_request) Failing after 3m8s
CI/CD / Publish immutable image (pull_request) Skipped

This commit is contained in:
Nico Schröder
2026-09-08 10:25:52 +00:00
committed by Twyco
parent fed6a282a4
commit 9895fc36db
50 changed files with 1504 additions and 624 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Resources;
use App\Actions\Projects\DuplicateProjectConfiguration;
use App\Models\ProjectTemplate;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -17,6 +18,8 @@ class ProjectTemplateResource extends JsonResource
public function toArray(Request $request): array
{
if ($this->resource instanceof ProjectTemplate) {
$configuration = app(DuplicateProjectConfiguration::class);
return [
'id' => $this->id,
'project_id' => $this->project_id,
@@ -27,8 +30,10 @@ class ProjectTemplateResource extends JsonResource
'name' => $this->name,
'slug' => $this->slug,
'is_published' => $this->is_published,
'copy_areas' => $this->copy_areas ?? [],
'configuration_snapshot' => $this->configuration_snapshot ?? [],
'copy_areas' => $configuration->normalizeCopyAreas($this->copy_areas ?? []),
'configuration_snapshot' => $configuration->normalizeConfiguration(
$this->configuration_snapshot ?? [],
),
'linked_project_count' => $this->whenCounted('linkedProjects'),
'created_at' => $this->created_at?->toISOString(),
'updated_at' => $this->updated_at?->toISOString(),