4913975e99
* fix transaction usgae in repos * other bug fixes
36 lines
455 B
TypeScript
36 lines
455 B
TypeScript
import {
|
|
IsNumber,
|
|
IsOptional,
|
|
IsPositive,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
} from 'class-validator';
|
|
|
|
export class PaginationOptions {
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(1)
|
|
page = 1;
|
|
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@IsPositive()
|
|
@Min(1)
|
|
@Max(100)
|
|
limit = 20;
|
|
|
|
@IsOptional()
|
|
@IsString()
|
|
query: string;
|
|
|
|
get offset(): number {
|
|
return (this.page - 1) * this.limit;
|
|
}
|
|
}
|
|
|
|
export enum PaginationSort {
|
|
ASC = 'asc',
|
|
DESC = 'desc',
|
|
}
|