Add application API and OpenAPI docs
linter / quality (pull_request) Successful in 1m18s
tests / ci (8.4) (pull_request) Successful in 1m28s

This commit is contained in:
2026-04-20 13:22:56 +02:00
parent 70d760e3a6
commit 8b25421e7c
80 changed files with 6908 additions and 1277 deletions
@@ -0,0 +1,35 @@
<?php
namespace App\Actions\ProjectTicketMetadata;
use App\Models\Project;
use App\Models\TicketFieldDefinition;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
class StoreTicketFieldDefinition
{
use ReordersProjectMetadata;
/**
* @param array{field_type: string, label: string, position?: int|null} $validated
*/
public function handle(Project $project, array $validated): TicketFieldDefinition
{
return DB::transaction(function () use ($project, $validated): TicketFieldDefinition {
$ticketFieldDefinition = $project->ticketFieldDefinitions()->create([
'field_type' => Arr::get($validated, 'field_type'),
'label' => Arr::get($validated, 'label'),
'position' => $project->ticketFieldDefinitions()->count() + 1,
]);
$this->reorderModels(
$project->ticketFieldDefinitions()->whereKeyNot($ticketFieldDefinition->id)->get()->values(),
$ticketFieldDefinition,
Arr::get($validated, 'position') ?? $project->ticketFieldDefinitions()->count(),
);
return $ticketFieldDefinition;
});
}
}