feat : #11 pagination
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { Profile } from '@app/domain/profiles/profile.model';
|
||||
import { Profile, ProfilePaginated } from '@app/domain/profiles/profile.model';
|
||||
import { Injectable } from '@angular/core';
|
||||
import PocketBase from 'pocketbase';
|
||||
import { environment } from '@env/environment';
|
||||
@@ -15,14 +15,18 @@ export class PbProfileRepository implements ProfileRepository {
|
||||
expand: 'utilisateur',
|
||||
};
|
||||
|
||||
list(params?: SearchFilters): Observable<Profile[]> {
|
||||
list(params?: SearchFilters): Observable<ProfilePaginated> {
|
||||
const requestOptions = {
|
||||
...this.defaultOptions,
|
||||
sort: this.onSortSetting(params),
|
||||
filter: this.onFilterSetting(params).join(' && '),
|
||||
};
|
||||
|
||||
return from(this.pb.collection('profiles').getFullList<Profile>(requestOptions));
|
||||
return from(
|
||||
this.pb
|
||||
.collection('profiles')
|
||||
.getList<ProfilePaginated>(params?.page, params?.perPage, requestOptions)
|
||||
);
|
||||
}
|
||||
|
||||
getByUserId(userId: string): Observable<Profile> {
|
||||
|
||||
Reference in New Issue
Block a user