import { ApiProperty } from '@nestjs/swagger'; export class ApiResponseMeta { @ApiProperty({ type: String, nullable: true }) cachedAt: string | null; @ApiProperty() fromCache: boolean; constructor(fromCache: boolean, cachedAt: string | null = null) { this.fromCache = fromCache; this.cachedAt = cachedAt; } } export class ApiResponse { data: T; meta: ApiResponseMeta; constructor(data: T, fromCache = false, cachedAt: string | null = null) { this.data = data; this.meta = new ApiResponseMeta(fromCache, cachedAt); } }