Skip to content

Commit

Permalink
fix(ill): add filter parameter
Browse files Browse the repository at this point in the history
The "remove_archived" parameter is used to filter the list of results.

* Closes rero/rero-ils#3527.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Apr 2, 2024
1 parent a54a507 commit 00f71c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class IllRequestComponent implements OnInit {
switchMap((patron: any) => {
return (!patron)
? of(null)
: this.illRequestApiService.getByPatronPid(patron.pid)
: this.illRequestApiService.getByPatronPid(patron.pid, {remove_archived: '1'})
}
));
}
Expand Down
7 changes: 4 additions & 3 deletions projects/public-search/src/app/api/ill-request-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ export class IllRequestApiService extends BaseApi {
page: number,
itemsPerPage: number = 10,
headers = BaseApi.reroJsonheaders,
sort: string = '-created'
sort: string = '-created',
filters?: {[key: string]: string}
): Observable<Record | Error> {
const query = `patron.pid:${patronPid} AND -status:denied AND -status:closed AND -loan_status:ITEM_RETURNED`;
return this._recordService.getRecords('ill_requests', query, page, itemsPerPage, undefined, undefined, headers, sort);
const query = `patron.pid:${patronPid}`;
return this._recordService.getRecords('ill_requests', query, page, itemsPerPage, undefined, filters, headers, sort);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { Error, Record } from '@rero/ng-core';
import { Paginator } from '@rero/shared';
import { BaseApi, Paginator } from '@rero/shared';
import { Observable, Subscription } from 'rxjs';
import { IllRequestApiService } from '../../api/ill-request-api.service';
import { PatronProfileMenuService } from '../patron-profile-menu.service';
Expand Down Expand Up @@ -106,6 +106,9 @@ export class PatronProfileIllRequestsComponent implements OnInit, OnDestroy {
private _illRequestQuery(page: number): Observable<Record | Error> {
const patronPid = this.patronProfileMenuService.currentPatron.pid;
return this.illRequestApiService
.getPublicIllRequest(patronPid, page, this.paginator.getRecordsPerPage());
.getPublicIllRequest(
patronPid, page, this.paginator.getRecordsPerPage(),
BaseApi.reroJsonheaders, '-created', {remove_archived: '1'}
);
}
}

0 comments on commit 00f71c1

Please sign in to comment.