stats-reporting.dto.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
  2. import { Type } from 'class-transformer';
  3. import { IsInt } from 'class-validator';
  4. export class BaseRangeQueryDto {
  5. @ApiProperty({
  6. description: 'UTC epoch seconds (inclusive)',
  7. example: 1767168000,
  8. })
  9. @Type(() => Number)
  10. @IsInt()
  11. fromSec!: number;
  12. @ApiProperty({
  13. description: 'UTC epoch seconds (exclusive)',
  14. example: 1767175200,
  15. })
  16. @Type(() => Number)
  17. @IsInt()
  18. toSec!: number;
  19. @ApiPropertyOptional({
  20. description: 'Page number (1-based). Default = 1',
  21. example: 1,
  22. default: 1,
  23. })
  24. page?: number;
  25. @ApiPropertyOptional({
  26. description: 'Page size. Default = 10',
  27. example: 10,
  28. default: 10,
  29. })
  30. size?: number;
  31. }
  32. export class AdsStatsQueryDto extends BaseRangeQueryDto {
  33. @ApiPropertyOptional({
  34. description: 'Ads ID (supported)',
  35. example: '694b8d79d8db191891d56ab6',
  36. })
  37. adsId?: string;
  38. @ApiPropertyOptional({
  39. description: 'Channel ID (ignored if not present in aggregates)',
  40. example: 'channel_001',
  41. })
  42. channelId?: string;
  43. @ApiPropertyOptional({
  44. description: 'Ad type (ignored if not present in aggregates)',
  45. example: 'BANNER',
  46. })
  47. adType?: string;
  48. }
  49. export class ChannelStatsQueryDto extends BaseRangeQueryDto {
  50. @ApiPropertyOptional({
  51. description: 'Channel ID',
  52. example: 'channel_001',
  53. })
  54. channelId?: string;
  55. }