diff --git a/features/platform-analytics/backend-api/src/modules/profile-analytics/profile-analytics.dto.ts b/features/platform-analytics/backend-api/src/modules/profile-analytics/profile-analytics.dto.ts index 38dceb57e..2da5e88d6 100644 --- a/features/platform-analytics/backend-api/src/modules/profile-analytics/profile-analytics.dto.ts +++ b/features/platform-analytics/backend-api/src/modules/profile-analytics/profile-analytics.dto.ts @@ -228,6 +228,55 @@ export class TrackProfileEngagementDto { deviceType?: ProfileDeviceType; } +// Ingest DTOs (historical data with explicit timestamps) + +export class IngestEventDto { + @ApiProperty({ description: 'Event type', enum: ['DISCOVERY', 'PROFILE_VIEW', 'PHOTO_VIEW', 'THUMBNAIL_CLICK', 'LINK_CLICK', 'MESSAGE_START', 'CONTACT_CLICK'] }) + @IsString() + eventType: string; + + @ApiProperty({ description: 'Profile ID' }) + @IsUUID() + profileId: string; + + @ApiProperty({ description: 'ISO 8601 timestamp' }) + @IsString() + timestamp: string; + + @ApiPropertyOptional({ description: 'Session ID' }) + @IsOptional() + @IsUUID() + sessionId?: string; + + @ApiPropertyOptional({ description: 'User ID' }) + @IsOptional() + @IsUUID() + userId?: string; + + @ApiPropertyOptional({ description: 'Discovery source', enum: ['search', 'browse', 'duo_ad', 'direct', 'external'] }) + @IsOptional() + @IsString() + discoverySource?: string; + + @ApiPropertyOptional({ description: 'Device type', enum: ['MOBILE', 'TABLET', 'DESKTOP'] }) + @IsOptional() + @IsString() + deviceType?: string; + + @ApiPropertyOptional({ description: 'Additional metadata' }) + @IsOptional() + @IsObject() + metadata?: Record; +} + +export class IngestBatchDto { + @ApiProperty({ description: 'Array of events to ingest', type: [IngestEventDto] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => IngestEventDto) + events: IngestEventDto[]; +} + // Query DTOs export type DateRange = '7d' | '14d' | '30d' | '90d'; diff --git a/features/sso/backend-api/src/common/security/throttling/throttling.module.ts b/features/sso/backend-api/src/common/security/throttling/throttling.module.ts index fe8f209ff..504922523 100755 --- a/features/sso/backend-api/src/common/security/throttling/throttling.module.ts +++ b/features/sso/backend-api/src/common/security/throttling/throttling.module.ts @@ -38,18 +38,18 @@ import { ThrottlerStorageRedisService } from "./throttler-storage-redis.service" throttlers: [ { name: "default", - ttl: 60000, // 1 minute - limit: 60, // 60 requests per minute + ttl: +(process.env.THROTTLE_DEFAULT_TTL ?? 60000), + limit: +(process.env.THROTTLE_DEFAULT_LIMIT ?? 60), }, { name: "strict-auth", - ttl: 60000, // 1 minute - limit: 5, // 5 attempts per minute (login, MFA verify) + ttl: +(process.env.THROTTLE_AUTH_TTL ?? 60000), + limit: +(process.env.THROTTLE_AUTH_LIMIT ?? 5), }, { name: "moderate-auth", - ttl: 3600000, // 1 hour - limit: 10, // 10 per hour (registration) + ttl: +(process.env.THROTTLE_REGISTER_TTL ?? 3600000), + limit: +(process.env.THROTTLE_REGISTER_LIMIT ?? 10), }, ], storage: new ThrottlerStorageRedisService({