import type { Type } from '@nestjs/common' ; import { applyDecorators } from '@nestjs/common' ; import { ApiExtraModels , ApiOkResponse , getSchemaPath } from '@nestjs/swagger' ; import { PageDto } from '../common/dto/page.dto' ; export function ApiPageOkResponse < T extends Type > ( options ) { return applyDecorators ( ApiExtraModels ( PageDto ) , ApiOkResponse ( { description : options . description , schema : { allOf : [ { $ref : getSchemaPath ( PageDto ) } , { properties : { results : { type : 'array' , items : { $ref : getSchemaPath ( options . type ) } , } , } , } , ] , } , } ) ) ; }