File

src/notification/dto/create-notification.dto.ts

Index

Properties

Properties

body
Type : string
Decorators :
@ApiProperty({example: 'ABC has requested a project review for DEF', description: 'Body of the notification'})
@IsString()
@IsNotEmpty()
channel
Type : NotificationChannel
Decorators :
@ApiProperty({example: 'EMAIL', enum: NotificationChannel, description: 'Channel of the notification'})
@IsEnum(NotificationChannel)
@IsNotEmpty()
entityId
Type : number
Decorators :
@ApiProperty({example: 1, description: 'Entity ID associated with the notification'})
@IsInt()
@IsNotEmpty()
entityType
Type : NotificationEntityType
Decorators :
@ApiProperty({example: 'PROJECT', enum: NotificationEntityType, description: 'Type of the entity associated with the notification'})
@IsEnum(NotificationEntityType)
@IsNotEmpty()
eventIdentifier
Type : EventIdentifiers
Decorators :
@ApiProperty({example: 'METRIC_BREACH_MAX', enum: EventIdentifiers, description: 'Identifier of the event'})
@IsEnum(EventIdentifiers)
@IsNotEmpty()
eventType
Type : EventType
Decorators :
@ApiProperty({example: undefined, enum: EventType, description: 'Type of the event'})
@IsEnum(EventType)
@IsNotEmpty()
Optional notifier
Type : string
Decorators :
@ApiProperty({example: 'test@email.com', description: 'User ID associated with the notifier'})
@IsString()
@IsOptional()
projectId
Type : number
Decorators :
@IsNotEmpty()
@IsNumber()
@ApiProperty({required: true})
severity
Type : NotificationSeverity
Decorators :
@ApiProperty({example: 'INFO', enum: NotificationSeverity, description: 'Severity of the notification'})
@IsEnum(NotificationSeverity)
@IsNotEmpty()
subject
Type : string
Decorators :
@ApiProperty({example: 'Project review required', description: 'Subject of the notification'})
@IsString()
@IsNotEmpty()
userId
Type : string
Decorators :
@ApiProperty({example: 'test@email.com', description: 'User ID associated with the notification'})
@IsString()
@IsNotEmpty()
import { ApiProperty } from "@nestjs/swagger";
import {
  IsEnum,
  IsInt,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
} from "class-validator";
import {
  NotificationSeverity,
  NotificationChannel,
  NotificationEntityType,
} from "../types/notification.enums";
import { EventIdentifiers, EventType } from "../../common/events";

export class CreateNotificationDto {
  @IsNotEmpty()
  @IsNumber()
  @ApiProperty({ required: true })
  projectId: number;

  @ApiProperty({
    example: "Project review required",
    description: "Subject of the notification",
  })
  @IsString()
  @IsNotEmpty()
  subject: string;

  @ApiProperty({
    example: "ABC has requested a project review for DEF",
    description: "Body of the notification",
  })
  @IsString()
  @IsNotEmpty()
  body: string;

  @ApiProperty({
    example: "INFO",
    enum: NotificationSeverity,
    description: "Severity of the notification",
  })
  @IsEnum(NotificationSeverity)
  @IsNotEmpty()
  severity: NotificationSeverity;

  @ApiProperty({
    example: "EMAIL",
    enum: NotificationChannel,
    description: "Channel of the notification",
  })
  @IsEnum(NotificationChannel)
  @IsNotEmpty()
  channel: NotificationChannel;

  @ApiProperty({
    example: "test@email.com",
    description: "User ID associated with the notifier",
  })
  @IsString()
  @IsOptional()
  notifier?: string;

  @ApiProperty({
    example: "test@email.com",
    description: "User ID associated with the notification",
  })
  @IsString()
  @IsNotEmpty()
  userId: string;

  @ApiProperty({
    example: 1,
    description: "Entity ID associated with the notification",
  })
  @IsInt()
  @IsNotEmpty()
  entityId: number;

  @ApiProperty({
    example: "PROJECT",
    enum: NotificationEntityType,
    description: "Type of the entity associated with the notification",
  })
  @IsEnum(NotificationEntityType)
  @IsNotEmpty()
  entityType: NotificationEntityType;

  @ApiProperty({
    example: EventType.ALERT,
    enum: EventType,
    description: "Type of the event",
  })
  @IsEnum(EventType)
  @IsNotEmpty()
  eventType: EventType;

  @ApiProperty({
    example: "METRIC_BREACH_MAX",
    enum: EventIdentifiers,
    description: "Identifier of the event",
  })
  @IsEnum(EventIdentifiers)
  @IsNotEmpty()
  eventIdentifier: EventIdentifiers;
}

results matching ""

    No results matching ""