mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Fix: including ordering param for id__in retrievals from frontend (#6875)
This commit is contained in:
@@ -100,13 +100,13 @@ export const commonAbstractPaperlessServiceTests = (endpoint, ServiceClass) => {
|
||||
test('should call appropriate api endpoint for get a few objects', () => {
|
||||
subscription = service.getFew([1, 2, 3]).subscribe()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=1,2,3`
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=1,2,3&ordering=-id`
|
||||
)
|
||||
expect(req.request.method).toEqual('GET')
|
||||
req.flush([])
|
||||
subscription = service.getFew([4, 5, 6], { foo: 'bar' }).subscribe()
|
||||
const req2 = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=4,5,6&foo=bar`
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=4,5,6&ordering=-id&foo=bar`
|
||||
)
|
||||
expect(req2.request.method).toEqual('GET')
|
||||
req2.flush([])
|
||||
|
@@ -94,6 +94,7 @@ export abstract class AbstractPaperlessService<T extends ObjectWithId> {
|
||||
getFew(ids: number[], extraParams?): Observable<Results<T>> {
|
||||
let httpParams = new HttpParams()
|
||||
httpParams = httpParams.set('id__in', ids.join(','))
|
||||
httpParams = httpParams.set('ordering', '-id')
|
||||
for (let extraParamKey in extraParams) {
|
||||
if (extraParams[extraParamKey] != null) {
|
||||
httpParams = httpParams.set(extraParamKey, extraParams[extraParamKey])
|
||||
|
Reference in New Issue
Block a user