feat: people infinite scroll (#11326)

* feat: people infinite scroll

* add infinite scroll to show & hide modal

* update unit tests

* show total people count instead of currently loaded

* update personsearchdto
This commit is contained in:
Michel Heusschen
2024-07-25 21:59:28 +02:00
committed by GitHub
parent 152421e288
commit 8e6bc13540
17 changed files with 276 additions and 67 deletions

View File

@@ -91,15 +91,22 @@ export class PersonService {
}
async getAll(auth: AuthDto, dto: PersonSearchDto): Promise<PeopleResponseDto> {
const { withHidden = false, page, size } = dto;
const pagination = {
take: size,
skip: (page - 1) * size,
};
const { machineLearning } = await this.configCore.getConfig({ withCache: false });
const people = await this.repository.getAllForUser(auth.user.id, {
const { items, hasNextPage } = await this.repository.getAllForUser(pagination, auth.user.id, {
minimumFaceCount: machineLearning.facialRecognition.minFaces,
withHidden: dto.withHidden || false,
withHidden,
});
const { total, hidden } = await this.repository.getNumberOfPeople(auth.user.id);
return {
people: people.map((person) => mapPerson(person)),
people: items.map((person) => mapPerson(person)),
hasNextPage,
total,
hidden,
};