mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
fix(api): some listens pages are not full
Without this option, some pages on the listens list are returning less than requested items.
This commit is contained in:
parent
ef84800ce8
commit
be38c383ef
2 changed files with 8 additions and 1 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
import { Test, TestingModule } from "@nestjs/testing";
|
import { Test, TestingModule } from "@nestjs/testing";
|
||||||
import { IPaginationOptions, paginate } from "nestjs-typeorm-paginate";
|
import {
|
||||||
|
IPaginationOptions,
|
||||||
|
paginate,
|
||||||
|
PaginationTypeEnum,
|
||||||
|
} from "nestjs-typeorm-paginate";
|
||||||
import { Track } from "../music-library/track.entity";
|
import { Track } from "../music-library/track.entity";
|
||||||
import { User } from "../users/user.entity";
|
import { User } from "../users/user.entity";
|
||||||
import { CreateListenResponseDto } from "./dto/create-listen.dto";
|
import { CreateListenResponseDto } from "./dto/create-listen.dto";
|
||||||
|
|
@ -107,6 +111,7 @@ describe("ListensService", () => {
|
||||||
expect(paginate).toHaveBeenCalledWith(scopes, {
|
expect(paginate).toHaveBeenCalledWith(scopes, {
|
||||||
page: options.page,
|
page: options.page,
|
||||||
limit: options.limit,
|
limit: options.limit,
|
||||||
|
paginationType: PaginationTypeEnum.TAKE_AND_SKIP,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import {
|
||||||
IPaginationOptions,
|
IPaginationOptions,
|
||||||
paginate,
|
paginate,
|
||||||
Pagination,
|
Pagination,
|
||||||
|
PaginationTypeEnum,
|
||||||
} from "nestjs-typeorm-paginate";
|
} from "nestjs-typeorm-paginate";
|
||||||
import {
|
import {
|
||||||
CreateListenRequestDto,
|
CreateListenRequestDto,
|
||||||
|
|
@ -52,6 +53,7 @@ export class ListensService {
|
||||||
return paginate<Listen>(queryBuilder, {
|
return paginate<Listen>(queryBuilder, {
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
|
paginationType: PaginationTypeEnum.TAKE_AND_SKIP,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue