From c284ff1714e19e29405f90b4d9647ec635c6d902 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 3 Dec 2023 23:39:36 +0100 Subject: [PATCH 1/3] add missing fields to StoreScheduleRequest --- .../Api/Client/Servers/Schedules/StoreScheduleRequest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php index 771407f105..5cc5ffb2a6 100644 --- a/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Schedules/StoreScheduleRequest.php @@ -19,9 +19,11 @@ public function rules(): array return [ 'name' => $rules['name'], 'is_active' => array_merge(['filled'], $rules['is_active']), + 'only_when_online' => $rules['only_when_online'], 'minute' => $rules['cron_minute'], 'hour' => $rules['cron_hour'], 'day_of_month' => $rules['cron_day_of_month'], + 'month' => $rules['cron_month'], 'day_of_week' => $rules['cron_day_of_week'], ]; } From d4fa2b9bc488c4f7e18bb9f47748599d1a2307f4 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 3 Dec 2023 23:45:17 +0100 Subject: [PATCH 2/3] fix tests --- .../Api/Client/Server/Schedule/CreateServerScheduleTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index f72ef09f57..887ceeb37b 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -57,7 +57,7 @@ public function testScheduleValidationRules() $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", []); $response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); - foreach (['name', 'minute', 'hour', 'day_of_month', 'day_of_week'] as $i => $field) { + foreach (['name', 'only_when_online', 'minute', 'hour', 'day_of_month', 'month', 'day_of_week'] as $i => $field) { $response->assertJsonPath("errors.$i.code", 'ValidationException'); $response->assertJsonPath("errors.$i.meta.rule", 'required'); $response->assertJsonPath("errors.$i.meta.source_field", $field); @@ -67,6 +67,7 @@ public function testScheduleValidationRules() ->postJson("/api/client/servers/$server->uuid/schedules", [ 'name' => 'Testing', 'is_active' => 'no', + 'only_when_online' => 'false', 'minute' => '*', 'hour' => '*', 'day_of_month' => '*', From b4d6184ad13a5a08ecbf683eee2efc0fd2bb658d Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 3 Dec 2023 23:46:21 +0100 Subject: [PATCH 3/3] only_when_online isn't actually required --- .../Api/Client/Server/Schedule/CreateServerScheduleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php index 887ceeb37b..22f131dde5 100644 --- a/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php +++ b/tests/Integration/Api/Client/Server/Schedule/CreateServerScheduleTest.php @@ -57,7 +57,7 @@ public function testScheduleValidationRules() $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", []); $response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); - foreach (['name', 'only_when_online', 'minute', 'hour', 'day_of_month', 'month', 'day_of_week'] as $i => $field) { + foreach (['name', 'minute', 'hour', 'day_of_month', 'month', 'day_of_week'] as $i => $field) { $response->assertJsonPath("errors.$i.code", 'ValidationException'); $response->assertJsonPath("errors.$i.meta.rule", 'required'); $response->assertJsonPath("errors.$i.meta.source_field", $field);