Add pagination for participant api index parent

This commit is contained in:
philipp lang 2024-06-20 23:25:47 +02:00
parent 646b292249
commit e9e8b193f4
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class ParticipantIndexAction
$data = match ($parent) {
null => $this->handle($form, $filter),
-1 => $this->getQuery($form, $filter)->where('parent_id', null)->get(),
-1 => $this->getQuery($form, $filter)->where('parent_id', null)->paginate(15),
default => $this->getQuery($form, $filter)->where('parent_id', $parent)->get(),
};

View File

@ -195,7 +195,8 @@ class ParticipantIndexActionTest extends FormTestCase
$this->callFilter('form.participant.index', [], ['form' => $form, 'parent' => -1])
->assertJsonPath('data.0.children_count', 2)
->assertJsonPath('data.1.children_count', 0);
->assertJsonPath('data.1.children_count', 0)
->assertJsonPath('meta.current_page', 1);
$this->callFilter('form.participant.index', [], ['form' => $form, 'parent' => $participant->id])->assertJsonPath('data.0.children_count', 0);
}
}