-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Expand file tree
/
Copy pathgenerate-layout-preview-response.dto.ts
More file actions
49 lines (44 loc) · 1.37 KB
/
generate-layout-preview-response.dto.ts
File metadata and controls
49 lines (44 loc) · 1.37 KB
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
import { ApiExtraModels, ApiProperty, ApiPropertyOptional, getSchemaPath, type ApiPropertyOptions } from '@nestjs/swagger';
import { ChannelTypeEnum } from '@novu/shared';
import { Type } from 'class-transformer';
import { IsOptional, IsString, ValidateNested } from 'class-validator';
import { LayoutPreviewPayloadDto } from './layout-preview-payload.dto';
export class EmailLayoutRenderOutput {
@ApiProperty({ description: 'Content of the email' })
@IsString()
body: string;
}
@ApiExtraModels(EmailLayoutRenderOutput)
export class GenerateLayoutPreviewResponseDto {
@ApiProperty({
description: 'Preview payload example',
type: () => LayoutPreviewPayloadDto,
})
@ValidateNested()
@Type(() => LayoutPreviewPayloadDto)
previewPayloadExample: LayoutPreviewPayloadDto;
@ApiPropertyOptional({
description: 'The payload schema that was used to generate the preview payload example',
type: Object,
nullable: true,
additionalProperties: true,
})
@IsOptional()
schema?: any | null;
@ApiProperty({
description: 'Preview result',
type: Object,
oneOf: [
{
properties: {
type: { enum: [ChannelTypeEnum.EMAIL] },
preview: { $ref: getSchemaPath(EmailLayoutRenderOutput) },
},
},
],
} as ApiPropertyOptions)
result: {
type: ChannelTypeEnum.EMAIL;
preview?: EmailLayoutRenderOutput;
};
}