66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Transform, Type } from 'class-transformer';
|
|
import { IsEmail, IsEnum, IsString, ValidateNested } from 'class-validator';
|
|
|
|
export class AuthLoginDTO {
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
P_EMAILADDR: string;
|
|
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
P_PASSWORD: string;
|
|
}
|
|
|
|
export enum MailTypeDTO {
|
|
REGISTER_CLIENT = "REGISTER_CLIENT",
|
|
REGISTER_SP = "REGISTER_SP",
|
|
REGISTER_USCIB = "REGISTER_USCIB",
|
|
FORGOT_PASSWORD = "FORGOT_PASSWORD"
|
|
// DEMO_MAIL = "DEMO_MAIL"
|
|
}
|
|
|
|
export class SendMailDTO {
|
|
@ApiProperty({ required: true, example: 'user@example.com' })
|
|
@IsEmail({}, { message: 'P_TO must be a valid email address' })
|
|
P_TO: string;
|
|
|
|
@ApiProperty({ enum: MailTypeDTO, required: true })
|
|
@Transform(({ value }) => value?.toUpperCase())
|
|
@IsEnum(MailTypeDTO, { message: "Invalid P_MAIL_TYPE" })
|
|
P_MAIL_TYPE: MailTypeDTO;
|
|
}
|
|
|
|
export class MailContextDTO {
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
to: string;
|
|
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
url: string;
|
|
|
|
}
|
|
|
|
export class MailTemplateDTO {
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
to: string;
|
|
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
subject: string;
|
|
|
|
// @ApiProperty({ required: true })
|
|
// @IsString()
|
|
// text: string;
|
|
|
|
@ApiProperty({ required: true })
|
|
@IsString()
|
|
template: string;
|
|
|
|
@ApiProperty({ type: () => MailContextDTO, required: true })
|
|
@ValidateNested()
|
|
@Type(() => MailContextDTO)
|
|
context: MailContextDTO;
|
|
} |