File

src/core/domain/dtos/page-meta.dto.ts

Description

Page model for pagination

Implements

PageMeta

Index

Properties

Properties

hasNext
Type : boolean
Decorators :
@ApiProperty({description: 'Flag, that shows if there's a page following the current one', example: true})

Flag, that shows if there's a page following the current one

hasPrev
Type : boolean
Decorators :
@ApiProperty({description: 'Flag, that shows if there's a page preceding the current one', example: true})

Flag, that shows if there's a page preceding the current one

order
Type : Order
Decorators :
@ApiProperty({description: 'Order of the elements on the page', example: undefined})

Order of the elements on the page

pagenum
Type : number
Decorators :
@ApiProperty({description: 'Current page number', minimum: 1, example: 3})

Current page number

pagesize
Type : number
Decorators :
@ApiProperty({description: 'Maximum number of elements on the page', minimum: 1, example: 20})

Maximum number of elements on the page

total
Type : number
Decorators :
@IsArray()
@ApiProperty({description: 'Total number of hits (results) acquired from the search', example: 314})

Total number of hits (results) acquired from the search

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;
}

results matching ""

    No results matching ""