Merge branch 'main' into states

# Conflicts:
#	app/Domain/CalendarGenerator.php
#	app/Domain/VacationRequestStateManager.php
#	app/Eloquent/Models/VacationRequest.php
#	app/Eloquent/Observers/VacationRequestObserver.php
#	composer.json
#	composer.lock
#	tests/Feature/VacationRequestTest.php
This commit is contained in:
Adrian Hopek
2022-02-24 09:38:50 +01:00
52 changed files with 2572 additions and 155 deletions

View File

@@ -24,8 +24,9 @@ class VacationRequestFactory extends Factory
return [
"user_id" => User::factory(),
"creator_id" => fn(array $attributes): int => $attributes["user_id"],
"year_period_id" => YearPeriod::factory(),
"name" => fn(array $attributes) => $this->generateName($attributes),
"name" => fn(array $attributes): string => $this->generateName($attributes),
"type" => $this->faker->randomElement(VacationType::cases()),
"state" => $this->faker->randomElement(VacationRequestStatesRetriever::all()),
"from" => $from,

View File

@@ -14,6 +14,7 @@ return new class() extends Migration {
Schema::create("vacation_requests", function (Blueprint $table): void {
$table->id();
$table->string("name");
$table->foreignIdFor(User::class, "creator_id")->constrained("users")->cascadeOnDelete();
$table->foreignIdFor(User::class)->constrained()->cascadeOnDelete();
$table->foreignIdFor(YearPeriod::class)->constrained()->cascadeOnDelete();
$table->string("type");
@@ -21,6 +22,7 @@ return new class() extends Migration {
$table->date("from");
$table->date("to");
$table->text("comment")->nullable();
$table->boolean("flow_skipped")->default(false);
$table->timestamps();
});
}

View File

@@ -77,6 +77,7 @@ class DatabaseSeeder extends Seeder
VacationRequest::factory()
->count(10)
->for($user)
->for($user, "creator")
->sequence(fn() => [
"year_period_id" => $yearPeriods->random()->id,
])