| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
- import {
- IsBoolean,
- IsInt,
- IsObject,
- IsOptional,
- IsString,
- Max,
- Min,
- ValidateNested,
- } from 'class-validator';
- import { Type } from 'class-transformer';
- export class ProviderVideoSyncHistoryItemDto {
- @ApiProperty({ type: String, example: 'Provider Video Sync' })
- title!: string;
- @ApiPropertyOptional({
- type: Number,
- description: 'Epoch seconds for last run',
- })
- runAt?: number;
- @ApiPropertyOptional({
- type: Number,
- description: 'Epoch seconds for full sync completion',
- })
- completedAt?: number;
- @ApiPropertyOptional({
- type: Number,
- description: 'Known processed count (not stored yet)',
- })
- processedCount: null = null;
- @ApiPropertyOptional({
- type: String,
- description: 'Checkpoint cursor value stored in referId',
- })
- updatedAtCursor?: string;
- @ApiPropertyOptional({
- type: Number,
- description: 'syncState.updatedAt (epoch seconds)',
- })
- updatedAt?: number;
- }
- export class ProviderVideoSyncHistoryDataDto {
- @ApiProperty({
- type: [ProviderVideoSyncHistoryItemDto],
- description: 'Cursor records for provider sync',
- })
- list!: ProviderVideoSyncHistoryItemDto[];
- @ApiProperty({ type: Number, description: 'Total rows available' })
- total!: number;
- }
- export class ProviderVideoSyncHistoryResponseDto {
- @ApiProperty({
- type: ProviderVideoSyncHistoryDataDto,
- })
- data!: ProviderVideoSyncHistoryDataDto;
- }
- class ProviderVideoSyncParamDto {
- @IsOptional()
- @IsString()
- status?: string;
- /**
- * ISO string; provider filters "updated after"
- * Example: "2025-12-18T21:19:09.227Z"
- */
- @IsOptional()
- @IsString()
- updatedAt?: string;
- /**
- * Allow extra provider param keys without strict validation.
- * If you want to lock this down later, replace with explicit fields.
- */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [k: string]: any;
- }
- export class ProviderVideoSyncRunDto {
- @IsOptional()
- @IsString()
- providerCode?: string;
- @IsOptional()
- @IsBoolean()
- fullSync?: boolean;
- @IsOptional()
- @IsBoolean()
- resetState?: boolean;
- /**
- * Optional override. In normal usage:
- * - fullSync: resumes from SyncState cursor
- * - incremental: pageNum is forced to 1
- */
- @IsOptional()
- @IsInt()
- @Min(1)
- pageNum?: number;
- /**
- * Default is handled by service; capped at 500 by service.
- */
- @IsOptional()
- @IsInt()
- @Min(1)
- @Max(15000)
- pageSize?: number;
- @IsOptional()
- @IsObject()
- @ValidateNested()
- @Type(() => ProviderVideoSyncParamDto)
- param?: ProviderVideoSyncParamDto;
- }
|