Merge pull request #216 from Boy132/update/storeschedulerequest

Add missing fields to StoreScheduleRequest
This commit is contained in:
Charles 2024-05-13 19:14:51 -04:00 committed by GitHub
commit f7e7864dfe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -19,9 +19,11 @@ class StoreScheduleRequest extends ViewScheduleRequest
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'],
];
}

View File

@ -57,7 +57,7 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
$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', '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 @@ class CreateServerScheduleTest extends ClientApiIntegrationTestCase
->postJson("/api/client/servers/$server->uuid/schedules", [
'name' => 'Testing',
'is_active' => 'no',
'only_when_online' => 'false',
'minute' => '*',
'hour' => '*',
'day_of_month' => '*',