All files / redis-smq-api/src/controllers/common/dto/queues message.DTO.ts

100% Statements 38/38
100% Branches 0/0
100% Functions 4/4
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10057x                   57x   57x     57x       57x     57x   57x       57x       57x     57x     57x     57x     57x     57x     57x     57x   57x     57x     57x     57x     57x     57x       57x       57x       57x     57x       57x     14x 57x     14x 57x    
import {
  Allow,
  IsBoolean,
  IsInt,
  IsNotEmpty,
  IsOptional,
  IsString,
  IsUUID,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
 
export class MessageQueueDTO {
  @IsString()
  @IsNotEmpty()
  name!: string;
 
  @IsString()
  @IsNotEmpty()
  ns!: string;
}
 
export class MessageMetadataDTO {
  @IsUUID('4')
  uuid!: string;
 
  @IsInt()
  @IsOptional()
  publishedAt: number | null = null;
 
  @IsInt()
  @IsOptional()
  scheduledAt: number | null = null;
 
  @IsBoolean()
  scheduledCronFired!: boolean;
 
  @IsInt()
  scheduledRepeatCount!: number;
 
  @IsInt()
  attempts!: number;
 
  @IsInt()
  nextScheduledDelay!: number;
 
  @IsInt()
  nextRetryDelay!: number;
 
  @IsBoolean()
  expired!: boolean;
}
 
export class MessageDTO {
  @IsInt()
  createdAt!: number;
 
  @IsInt()
  ttl!: number;
 
  @IsInt()
  retryThreshold!: number;
 
  @IsInt()
  retryDelay!: number;
 
  @IsInt()
  consumeTimeout!: number;
 
  @Allow()
  body: unknown = null;
 
  @IsString()
  @IsOptional()
  scheduledCron: string | null = null;
 
  @IsInt()
  @IsOptional()
  scheduledDelay: number | null = null;
 
  @IsInt()
  @IsOptional()
  scheduledRepeatPeriod: number | null = null;
 
  @IsInt()
  scheduledRepeat!: number;
 
  @IsInt()
  @IsOptional()
  priority: number | null = null;
 
  @ValidateNested()
  @Type(() => MessageQueueDTO)
  queue: MessageQueueDTO | undefined | null;
 
  @ValidateNested()
  @Type(() => MessageMetadataDTO)
  metadata: MessageMetadataDTO | undefined | null;
}