feat(analytics): add GET /analytics/market-history endpoint
Time-series endpoint returning monthly/weekly market data points for the analytics page. Queries MarketIndex aggregated by period with 6-hour Redis cache. Includes unit tests. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { PropertyType } from '@prisma/client';
|
||||
import { IsEnum, IsIn, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class GetMarketHistoryDto {
|
||||
@ApiProperty({ description: 'City name', example: 'HCMC' })
|
||||
@IsString()
|
||||
city!: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Look-back period (e.g. 12m, 6m, 24m)',
|
||||
example: '12m',
|
||||
})
|
||||
@IsString()
|
||||
period!: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Time granularity',
|
||||
enum: ['monthly', 'weekly'],
|
||||
default: 'monthly',
|
||||
})
|
||||
@IsIn(['monthly', 'weekly'])
|
||||
granularity!: 'monthly' | 'weekly';
|
||||
|
||||
@ApiPropertyOptional({ enum: PropertyType, description: 'Property type filter' })
|
||||
@IsOptional()
|
||||
@IsEnum(PropertyType)
|
||||
propertyType?: PropertyType;
|
||||
}
|
||||
Reference in New Issue
Block a user