feat: person tags system - org-level skills with self-reported and organiser-assigned sources

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 11:15:43 +02:00
parent 5dbe7a254e
commit d37a45b028
21 changed files with 1375 additions and 1 deletions

View File

@@ -24,6 +24,23 @@ final class PersonResource extends JsonResource
'created_at' => $this->created_at->toIso8601String(),
'crowd_type' => new CrowdTypeResource($this->whenLoaded('crowdType')),
'company' => new CompanyResource($this->whenLoaded('company')),
'tags' => $this->when(
$this->user_id && $this->relationLoaded('user'),
function () {
$orgId = $this->event?->organisation_id;
if (!$orgId || !$this->user) {
return [];
}
return UserOrganisationTagResource::collection(
$this->user->organisationTags()
->where('organisation_id', $orgId)
->with('personTag')
->get()
);
},
[]
),
];
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Http\Resources\Api\V1;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
final class PersonTagResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'organisation_id' => $this->organisation_id,
'name' => $this->name,
'category' => $this->category,
'icon' => $this->icon,
'color' => $this->color,
'is_active' => $this->is_active,
'sort_order' => $this->sort_order,
'created_at' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace App\Http\Resources\Api\V1;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
final class UserOrganisationTagResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'person_tag' => [
'id' => $this->personTag->id,
'name' => $this->personTag->name,
'category' => $this->personTag->category,
'icon' => $this->personTag->icon,
'color' => $this->personTag->color,
],
'source' => $this->source,
'proficiency' => $this->proficiency,
'notes' => $this->notes,
'assigned_at' => $this->assigned_at->toIso8601String(),
'assigned_by' => $this->when(
$this->source === 'organiser_assigned' && $this->relationLoaded('assignedBy') && $this->assignedBy,
fn () => ['id' => $this->assignedBy->id, 'name' => $this->assignedBy->name],
),
];
}
}