ticket type rework

This commit is contained in:
2026-04-12 22:56:59 +02:00
parent f899893a6a
commit 041e79efda
11 changed files with 120 additions and 97 deletions
@@ -3,40 +3,31 @@
namespace App\Actions\ProjectTicketMetadata;
use App\Models\Project;
use App\Models\TicketType;
class InitializeProjectTicketMetadata
{
public function handle(Project $project): void
{
$project->ticketTypes()->firstOrCreate(
['system_key' => 'task'],
$project->ticketTypes()->create(
[
'is_builtin' => true,
'name' => 'Task',
'position' => 1,
],
);
$project->ticketTypes()->firstOrCreate(
['system_key' => 'parent'],
$project->ticketTypes()->create(
[
'is_builtin' => true,
'name' => 'Parent',
'name' => 'Release',
'is_parent' => true,
'position' => 2,
],
);
$project->ticketTypes()
->whereIn('system_key', TicketType::BUILTIN_KEYS)
->orderBy('position')
->get()
->values()
->each(function (TicketType $ticketType, int $index): void {
$ticketType->forceFill([
'is_builtin' => true,
'position' => $index + 1,
])->saveQuietly();
});
$project->ticketPriorities()->create(
[
'name' => 'Medium',
'position' => 1,
]
);
}
}