36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { IsArray, IsString, IsOptional, IsNumber, ValidateNested, IsObject } from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
export class EventItemDto {
|
|
@ApiProperty({ description: '事件名称', example: 'app_session_start' })
|
|
@IsString()
|
|
eventName: string;
|
|
|
|
@ApiPropertyOptional({ description: '用户ID (登录用户)', example: '12345' })
|
|
@IsOptional()
|
|
@IsString()
|
|
userId?: string;
|
|
|
|
@ApiProperty({ description: '安装ID', example: 'uuid-xxx-xxx' })
|
|
@IsString()
|
|
installId: string;
|
|
|
|
@ApiProperty({ description: '客户端时间戳 (秒)', example: 1732685100 })
|
|
@IsNumber()
|
|
clientTs: number;
|
|
|
|
@ApiPropertyOptional({ description: '事件属性' })
|
|
@IsOptional()
|
|
@IsObject()
|
|
properties?: Record<string, unknown>;
|
|
}
|
|
|
|
export class BatchEventsDto {
|
|
@ApiProperty({ type: [EventItemDto], description: '事件列表' })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => EventItemDto)
|
|
events: EventItemDto[];
|
|
}
|