Files
goodgo-platform/apps/api/src/modules/analytics/presentation/dto/get-price-movers.dto.ts
Ho Ngoc Hai 0651074319 feat(analytics): add GET /analytics/price-movers endpoint
Top tăng/giảm giá theo district cho Home dashboard.
Compares avg listing prices between current and previous time windows,
filters by min sample size (10), caches for 30 min.

TEC-3053

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-21 02:24:44 +07:00

48 lines
1.1 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsIn, IsInt, IsOptional, Max, Min } from 'class-validator';
export class GetPriceMoversDto {
@ApiProperty({
description: 'Price movement direction',
enum: ['up', 'down'],
example: 'up',
})
@IsIn(['up', 'down'])
direction: 'up' | 'down' = 'up';
@ApiPropertyOptional({
description: 'Look-back period',
enum: ['7d', '14d', '30d'],
default: '7d',
example: '7d',
})
@IsOptional()
@IsIn(['7d', '14d', '30d'])
period: string = '7d';
@ApiPropertyOptional({
description: 'Maximum number of results to return',
minimum: 1,
maximum: 20,
default: 5,
example: 5,
})
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
@Max(20)
limit: number = 5;
@ApiPropertyOptional({
description: 'Geographic aggregation level (currently only "district" is supported)',
enum: ['district'],
default: 'district',
example: 'district',
})
@IsOptional()
@IsIn(['district'])
level: 'district' = 'district';
}