add missing fields to StoreScheduleRequest

This commit is contained in:
Boy132 2024-05-13 18:55:59 +02:00
parent f9e8adad30
commit 703e5480ff
2 changed files with 4 additions and 1 deletions

View File

@ -19,9 +19,11 @@ class StoreScheduleRequest extends ViewScheduleRequest
return [ return [
'name' => $rules['name'], 'name' => $rules['name'],
'is_active' => array_merge(['filled'], $rules['is_active']), 'is_active' => array_merge(['filled'], $rules['is_active']),
'only_when_online' => $rules['only_when_online'],
'minute' => $rules['cron_minute'], 'minute' => $rules['cron_minute'],
'hour' => $rules['cron_hour'], 'hour' => $rules['cron_hour'],
'day_of_month' => $rules['cron_day_of_month'], 'day_of_month' => $rules['cron_day_of_month'],
'month' => $rules['cron_month'],
'day_of_week' => $rules['cron_day_of_week'], 'day_of_week' => $rules['cron_day_of_week'],
]; ];
} }

View File

@ -57,7 +57,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
$response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", []); $response = $this->actingAs($user)->postJson("/api/client/servers/$server->uuid/schedules", []);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); $response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY);
foreach (['name', 'minute', 'hour', 'day_of_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.code", 'ValidationException');
$response->assertJsonPath("errors.$i.meta.rule", 'required'); $response->assertJsonPath("errors.$i.meta.rule", 'required');
$response->assertJsonPath("errors.$i.meta.source_field", $field); $response->assertJsonPath("errors.$i.meta.source_field", $field);
@ -67,6 +67,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
->postJson("/api/client/servers/$server->uuid/schedules", [ ->postJson("/api/client/servers/$server->uuid/schedules", [
'name' => 'Testing', 'name' => 'Testing',
'is_active' => 'no', 'is_active' => 'no',
'only_when_online' => 'false',
'minute' => '*', 'minute' => '*',
'hour' => '*', 'hour' => '*',
'day_of_month' => '*', 'day_of_month' => '*',