src/core/domain/dtos/page.dto.ts
Page model for pagination
Properties |
constructor(data: PaperDto[], meta: PageMeta)
|
|||||||||
Defined in src/core/domain/dtos/page.dto.ts:32
|
|||||||||
Constructs an object with provided parameters
Parameters :
|
Readonly data |
Type : PaperDto[]
|
Decorators :
@IsArray()
|
Defined in src/core/domain/dtos/page.dto.ts:23
|
Data block of the page |
Readonly meta |
Type : PageMeta
|
Decorators :
@ApiProperty({description: 'Metadata for the page'})
|
Defined in src/core/domain/dtos/page.dto.ts:32
|
Metadata of the page |
import { ApiProperty } from "@nestjs/swagger";
import { IsArray } from "class-validator";
import { PageMeta } from "../interfaces/page-meta.interface";
import { PaperDto } from "./paper.dto";
/**
* List of allowed properties in this DTO
*/
const allowedProperties = ['data', 'meta'];
/**
* Page model for pagination
*/
export class PageDto {
/**
* Data block of the page
*/
@IsArray()
@ApiProperty({
description: 'All data the page contains',
isArray: true,
})
readonly data: PaperDto[];
/**
* Metadata of the page
*/
@ApiProperty({
description: 'Metadata for the page',
// example: [],
})
readonly meta: PageMeta;
/**
* Constructs an object with provided parameters
* @param data
* @param meta
*/
constructor(data: PaperDto[], meta: PageMeta) {
this.data = data;
this.meta = meta;
}
}