73 lines
1.8 KiB
TypeScript
73 lines
1.8 KiB
TypeScript
import { ApiExtraModels, ApiProperty, PartialType } from "@nestjs/swagger";
|
|
import { IsArray } from "class-validator";
|
|
import { Order } from "../enums";
|
|
import { PageMeta } from "../interfaces/page-meta.interface";
|
|
import { PaperDto } from "./paper.dto";
|
|
|
|
/**
|
|
* List of allowed properties in this DTO
|
|
*/
|
|
const allowedProperties = ['total', 'pagenum', 'order', 'hasNext', 'hasPrev', 'pagesize'];
|
|
|
|
/**
|
|
* Page model for pagination
|
|
*/
|
|
@ApiExtraModels()
|
|
export class PageMetaDto implements PageMeta {
|
|
/**
|
|
* Total number of hits (results) acquired from the search
|
|
*/
|
|
@IsArray()
|
|
@ApiProperty({
|
|
description: 'Total number of hits (results) acquired from the search',
|
|
example: 314
|
|
})
|
|
total: number;
|
|
|
|
/**
|
|
* Current page number
|
|
*/
|
|
@ApiProperty({
|
|
description: 'Current page number',
|
|
minimum: 1,
|
|
example: 3
|
|
})
|
|
pagenum: number;
|
|
|
|
/**
|
|
* Order of the elements on the page
|
|
*/
|
|
@ApiProperty({
|
|
description: 'Order of the elements on the page',
|
|
example: Order.DESC
|
|
})
|
|
order: Order;
|
|
|
|
/**
|
|
* Flag, that shows if there's a page following the current one
|
|
*/
|
|
@ApiProperty({
|
|
description: 'Flag, that shows if there\'s a page following the current one',
|
|
example: true
|
|
})
|
|
hasNext: boolean;
|
|
|
|
/**
|
|
* Flag, that shows if there's a page preceding the current one
|
|
*/
|
|
@ApiProperty({
|
|
description: 'Flag, that shows if there\'s a page preceding the current one',
|
|
example: true
|
|
})
|
|
hasPrev: boolean;
|
|
|
|
/**
|
|
* Maximum number of elements on the page
|
|
*/
|
|
@ApiProperty({
|
|
description: 'Maximum number of elements on the page',
|
|
minimum: 1,
|
|
example: 20
|
|
})
|
|
pagesize: number;
|
|
} |