Add zip and location to default model
This commit is contained in:
parent
4497084ae6
commit
a1981c7dec
|
@ -53,6 +53,8 @@ class FormResource extends JsonResource
|
|||
'needs_prevention' => $this->needs_prevention,
|
||||
'prevention_text' => $this->prevention_text,
|
||||
'prevention_conditions' => $this->prevention_conditions,
|
||||
'zip' => $this->zip,
|
||||
'location' => $this->location,
|
||||
'links' => [
|
||||
'participant_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => null]),
|
||||
'participant_root_index' => route('form.participant.index', ['form' => $this->getModel(), 'parent' => -1]),
|
||||
|
@ -102,6 +104,8 @@ class FormResource extends JsonResource
|
|||
'id' => null,
|
||||
'export' => ExportData::from([]),
|
||||
'prevention_conditions' => ['mode' => 'all', 'ifs' => []],
|
||||
'zip' => '',
|
||||
'location' => '',
|
||||
],
|
||||
'section_default' => [
|
||||
'name' => '',
|
||||
|
|
|
@ -57,6 +57,8 @@ class FormFactory extends Factory
|
|||
'is_private' => false,
|
||||
'export' => ExportData::from([]),
|
||||
'prevention_conditions' => Condition::defaults(),
|
||||
'zip' => $this->faker->numberBetween(1100, 99999),
|
||||
'location' => $this->faker->city(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ class FormIndexActionTest extends FormTestCase
|
|||
->registrationUntil('2023-04-01 05:00:00')
|
||||
->sections([FormtemplateSectionRequest::new()->name('sname')->fields([$this->textField()])])
|
||||
->has(Participant::factory()->count(5))
|
||||
->zip('12345')
|
||||
->location('SG')
|
||||
->create();
|
||||
|
||||
sleep(1);
|
||||
|
@ -46,6 +48,8 @@ class FormIndexActionTest extends FormTestCase
|
|||
->assertInertiaPath('data.data.0.from_human', '05.05.2023')
|
||||
->assertInertiaPath('data.data.0.to_human', '07.06.2023')
|
||||
->assertInertiaPath('data.data.0.from', '2023-05-05')
|
||||
->assertInertiaPath('data.data.0.zip', '12345')
|
||||
->assertInertiaPath('data.data.0.location', 'SG')
|
||||
->assertInertiaPath('data.data.0.participants_count', 5)
|
||||
->assertInertiaPath('data.data.0.to', '2023-06-07')
|
||||
->assertInertiaPath('data.data.0.is_active', true)
|
||||
|
@ -70,7 +74,9 @@ class FormIndexActionTest extends FormTestCase
|
|||
->assertInertiaPath('data.meta.base_url', url(''))
|
||||
->assertInertiaPath('data.meta.namiTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
||||
->assertInertiaPath('data.meta.specialTypes.0', ['id' => 'Vorname', 'name' => 'Vorname'])
|
||||
->assertInertiaPath('data.meta.section_default.name', '');
|
||||
->assertInertiaPath('data.meta.section_default.name', '')
|
||||
->assertInertiaPath('data.meta.default.zip', '')
|
||||
->assertInertiaPath('data.meta.default.location', '');
|
||||
}
|
||||
|
||||
public function testFormtemplatesHaveData(): void
|
||||
|
|
Loading…
Reference in New Issue