Added time estimates for projects and tasks, fixes ST-283

This commit is contained in:
Constantin Graf
2024-07-02 16:36:15 +02:00
committed by Gregor Vostrak
parent 78ea8a673b
commit a820d8540f
18 changed files with 402 additions and 6 deletions

View File

@@ -33,9 +33,19 @@ class ProjectFactory extends Factory
'archived_at' => null,
'client_id' => null,
'organization_id' => Organization::factory(),
'estimated_time' => null,
];
}
public function withEstimatedTime(): self
{
return $this->state(function (array $attributes): array {
return [
'estimated_time' => $this->faker->randomNumber(3),
];
});
}
public function billable(): self
{
return $this->state(function (array $attributes): array {

View File

@@ -26,6 +26,7 @@ class TaskFactory extends Factory
'project_id' => Project::factory(),
'organization_id' => Organization::factory(),
'done_at' => null,
'estimated_time' => null,
];
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('projects', function (Blueprint $table): void {
$table->integer('estimated_time')->unsigned()->nullable();
});
Schema::table('tasks', function (Blueprint $table): void {
$table->integer('estimated_time')->unsigned()->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('projects', function (Blueprint $table): void {
$table->dropColumn('estimated_time');
});
Schema::table('tasks', function (Blueprint $table): void {
$table->dropColumn('estimated_time');
});
}
};