78b1c1a453
* add cursor pagination function * support custom order modifier * refactor returned object * feat(db): migrate paginated endpoints to cursor-based pagination * sync * support hasPrevPage boolean * feat(client): migrate pagination from offset to cursor-based * support beforeCursor/prevCursor * wrap search results in items array for API consistency
35 lines
440 B
TypeScript
35 lines
440 B
TypeScript
import {
|
|
IsBoolean,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsPositive,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
} from 'class-validator';
|
|
|
|
export class PaginationOptions {
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@IsPositive()
|
|
@Min(1)
|
|
@Max(100)
|
|
limit = 20;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
cursor?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
beforeCursor?: string;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
query: string;
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
adminView: boolean;
|
|
}
|