@flusys/nestjs-email 1.1.0-beta → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +604 -0
- package/cjs/config/email.constants.js +0 -18
- package/cjs/config/index.js +0 -1
- package/cjs/controllers/email-config.controller.js +46 -4
- package/cjs/controllers/email-send.controller.js +13 -26
- package/cjs/controllers/email-template.controller.js +60 -11
- package/cjs/docs/email-swagger.config.js +18 -80
- package/cjs/dtos/email-config.dto.js +6 -106
- package/cjs/dtos/email-send.dto.js +101 -123
- package/cjs/dtos/email-template.dto.js +41 -103
- package/cjs/entities/email-config-with-company.entity.js +2 -2
- package/cjs/entities/email-config.entity.js +91 -3
- package/cjs/entities/email-template-with-company.entity.js +5 -3
- package/cjs/entities/email-template.entity.js +119 -3
- package/cjs/entities/index.js +34 -19
- package/cjs/index.js +1 -0
- package/cjs/interfaces/email-provider.interface.js +1 -3
- package/cjs/modules/email.module.js +50 -104
- package/cjs/providers/email-factory.service.js +37 -109
- package/cjs/providers/email-provider.registry.js +5 -15
- package/cjs/providers/mailgun-provider.js +54 -58
- package/cjs/providers/sendgrid-provider.js +68 -92
- package/cjs/providers/smtp-provider.js +58 -69
- package/cjs/{config → services}/email-config.service.js +9 -32
- package/cjs/services/email-datasource.provider.js +17 -104
- package/cjs/services/email-provider-config.service.js +28 -58
- package/cjs/services/email-send.service.js +120 -125
- package/cjs/services/email-template.service.js +62 -85
- package/cjs/services/index.js +2 -1
- package/cjs/utils/email-templates.util.js +64 -0
- package/cjs/utils/index.js +18 -0
- package/config/email.constants.d.ts +0 -9
- package/config/index.d.ts +0 -1
- package/controllers/email-send.controller.d.ts +5 -12
- package/controllers/email-template.controller.d.ts +5 -7
- package/dtos/email-config.dto.d.ts +5 -13
- package/dtos/email-send.dto.d.ts +17 -21
- package/dtos/email-template.dto.d.ts +5 -16
- package/entities/email-config-with-company.entity.d.ts +2 -2
- package/entities/email-config.entity.d.ts +9 -2
- package/entities/email-template-with-company.entity.d.ts +2 -2
- package/entities/email-template.entity.d.ts +13 -2
- package/entities/index.d.ts +9 -3
- package/fesm/config/email.constants.js +0 -9
- package/fesm/config/index.js +0 -1
- package/fesm/controllers/email-config.controller.js +49 -7
- package/fesm/controllers/email-send.controller.js +13 -26
- package/fesm/controllers/email-template.controller.js +61 -12
- package/fesm/docs/email-swagger.config.js +21 -86
- package/fesm/dtos/email-config.dto.js +9 -115
- package/fesm/dtos/email-send.dto.js +103 -139
- package/fesm/dtos/email-template.dto.js +43 -111
- package/fesm/entities/email-config-with-company.entity.js +2 -2
- package/fesm/entities/email-config.entity.js +92 -4
- package/fesm/entities/email-template-with-company.entity.js +5 -3
- package/fesm/entities/email-template.entity.js +120 -4
- package/fesm/entities/index.js +22 -16
- package/fesm/index.js +1 -0
- package/fesm/interfaces/email-config.interface.js +1 -3
- package/fesm/interfaces/email-module-options.interface.js +1 -3
- package/fesm/interfaces/email-provider.interface.js +1 -5
- package/fesm/interfaces/email-template.interface.js +1 -3
- package/fesm/modules/email.module.js +52 -106
- package/fesm/providers/email-factory.service.js +38 -69
- package/fesm/providers/email-provider.registry.js +6 -19
- package/fesm/providers/mailgun-provider.js +55 -63
- package/fesm/providers/sendgrid-provider.js +69 -97
- package/fesm/providers/smtp-provider.js +59 -73
- package/fesm/{config → services}/email-config.service.js +9 -32
- package/fesm/services/email-datasource.provider.js +18 -64
- package/fesm/services/email-provider-config.service.js +26 -56
- package/fesm/services/email-send.service.js +118 -123
- package/fesm/services/email-template.service.js +60 -83
- package/fesm/services/index.js +2 -1
- package/fesm/utils/email-templates.util.js +47 -0
- package/fesm/utils/index.js +1 -0
- package/index.d.ts +1 -0
- package/interfaces/email-config.interface.d.ts +6 -0
- package/interfaces/email-module-options.interface.d.ts +0 -5
- package/modules/email.module.d.ts +1 -2
- package/package.json +9 -4
- package/providers/email-factory.service.d.ts +4 -7
- package/providers/mailgun-provider.d.ts +6 -2
- package/providers/sendgrid-provider.d.ts +6 -2
- package/providers/smtp-provider.d.ts +7 -2
- package/services/email-config.service.d.ts +12 -0
- package/services/email-datasource.provider.d.ts +3 -6
- package/services/email-provider-config.service.d.ts +3 -3
- package/services/email-send.service.d.ts +11 -3
- package/services/email-template.service.d.ts +5 -4
- package/services/index.d.ts +2 -1
- package/utils/email-templates.util.d.ts +2 -0
- package/utils/index.d.ts +1 -0
- package/cjs/entities/email-config-base.entity.js +0 -111
- package/cjs/entities/email-template-base.entity.js +0 -134
- package/config/email-config.service.d.ts +0 -13
- package/entities/email-config-base.entity.d.ts +0 -11
- package/entities/email-template-base.entity.d.ts +0 -14
- package/fesm/entities/email-config-base.entity.js +0 -101
- package/fesm/entities/email-template-base.entity.js +0 -124
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "EmailSendController", {
|
|
|
8
8
|
return EmailSendController;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _guards = require("@flusys/nestjs-shared/guards");
|
|
12
11
|
const _decorators = require("@flusys/nestjs-shared/decorators");
|
|
12
|
+
const _guards = require("@flusys/nestjs-shared/guards");
|
|
13
13
|
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
14
14
|
const _common = require("@nestjs/common");
|
|
15
15
|
const _swagger = require("@nestjs/swagger");
|
|
@@ -43,38 +43,22 @@ function _ts_param(paramIndex, decorator) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
let EmailSendController = class EmailSendController {
|
|
46
|
-
|
|
47
|
-
* Send email directly (without template)
|
|
48
|
-
*/ async sendEmail(dto, user) {
|
|
46
|
+
async sendEmail(dto, user) {
|
|
49
47
|
const result = await this.emailSendService.sendEmail(dto, user);
|
|
50
|
-
return
|
|
51
|
-
success: result.success,
|
|
52
|
-
data: {
|
|
53
|
-
success: result.success,
|
|
54
|
-
messageId: result.messageId,
|
|
55
|
-
error: result.error
|
|
56
|
-
}
|
|
57
|
-
};
|
|
48
|
+
return this.toResponse(result, 'Email');
|
|
58
49
|
}
|
|
59
|
-
|
|
60
|
-
* Send email using template
|
|
61
|
-
*/ async sendTemplateEmail(dto, user) {
|
|
50
|
+
async sendTemplateEmail(dto, user) {
|
|
62
51
|
const result = await this.emailSendService.sendTemplateEmail(dto, user);
|
|
63
|
-
return
|
|
64
|
-
success: result.success,
|
|
65
|
-
data: {
|
|
66
|
-
success: result.success,
|
|
67
|
-
messageId: result.messageId,
|
|
68
|
-
error: result.error
|
|
69
|
-
}
|
|
70
|
-
};
|
|
52
|
+
return this.toResponse(result, 'Template email');
|
|
71
53
|
}
|
|
72
|
-
|
|
73
|
-
* Send test email (for testing configuration)
|
|
74
|
-
*/ async sendTestEmail(dto, user) {
|
|
54
|
+
async sendTestEmail(dto, user) {
|
|
75
55
|
const result = await this.emailSendService.sendTestEmail(dto.emailConfigId, dto.recipient, user);
|
|
56
|
+
return this.toResponse(result, 'Test email');
|
|
57
|
+
}
|
|
58
|
+
toResponse(result, label) {
|
|
76
59
|
return {
|
|
77
60
|
success: result.success,
|
|
61
|
+
message: result.success ? `${label} sent successfully` : `Failed to send ${label.toLowerCase()}`,
|
|
78
62
|
data: {
|
|
79
63
|
success: result.success,
|
|
80
64
|
messageId: result.messageId,
|
|
@@ -89,6 +73,7 @@ let EmailSendController = class EmailSendController {
|
|
|
89
73
|
};
|
|
90
74
|
_ts_decorate([
|
|
91
75
|
(0, _common.Post)('direct'),
|
|
76
|
+
(0, _decorators.RequirePermission)('email.send'),
|
|
92
77
|
(0, _swagger.ApiOperation)({
|
|
93
78
|
summary: 'Send email directly with custom content'
|
|
94
79
|
}),
|
|
@@ -103,6 +88,7 @@ _ts_decorate([
|
|
|
103
88
|
], EmailSendController.prototype, "sendEmail", null);
|
|
104
89
|
_ts_decorate([
|
|
105
90
|
(0, _common.Post)('template'),
|
|
91
|
+
(0, _decorators.RequirePermission)('email.send'),
|
|
106
92
|
(0, _swagger.ApiOperation)({
|
|
107
93
|
summary: 'Send email using a template with variable interpolation'
|
|
108
94
|
}),
|
|
@@ -117,6 +103,7 @@ _ts_decorate([
|
|
|
117
103
|
], EmailSendController.prototype, "sendTemplateEmail", null);
|
|
118
104
|
_ts_decorate([
|
|
119
105
|
(0, _common.Post)('test'),
|
|
106
|
+
(0, _decorators.RequirePermission)('email.send'),
|
|
120
107
|
(0, _swagger.ApiOperation)({
|
|
121
108
|
summary: 'Send a test email to verify configuration'
|
|
122
109
|
}),
|
|
@@ -8,12 +8,12 @@ Object.defineProperty(exports, "EmailTemplateController", {
|
|
|
8
8
|
return EmailTemplateController;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _guards = require("@flusys/nestjs-shared/guards");
|
|
12
11
|
const _classes = require("@flusys/nestjs-shared/classes");
|
|
13
|
-
const _common = require("@nestjs/common");
|
|
14
|
-
const _swagger = require("@nestjs/swagger");
|
|
15
12
|
const _decorators = require("@flusys/nestjs-shared/decorators");
|
|
13
|
+
const _guards = require("@flusys/nestjs-shared/guards");
|
|
16
14
|
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
15
|
+
const _common = require("@nestjs/common");
|
|
16
|
+
const _swagger = require("@nestjs/swagger");
|
|
17
17
|
const _dtos = require("../dtos");
|
|
18
18
|
const _services = require("../services");
|
|
19
19
|
function _define_property(obj, key, value) {
|
|
@@ -43,14 +43,58 @@ function _ts_param(paramIndex, decorator) {
|
|
|
43
43
|
decorator(target, key, paramIndex);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
let EmailTemplateController = class EmailTemplateController extends (0, _classes.createApiController)(_dtos.CreateEmailTemplateDto, _dtos.UpdateEmailTemplateDto, _dtos.EmailTemplateResponseDto
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
let EmailTemplateController = class EmailTemplateController extends (0, _classes.createApiController)(_dtos.CreateEmailTemplateDto, _dtos.UpdateEmailTemplateDto, _dtos.EmailTemplateResponseDto, {
|
|
47
|
+
security: {
|
|
48
|
+
insert: {
|
|
49
|
+
level: 'permission',
|
|
50
|
+
permissions: [
|
|
51
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.CREATE
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
insertMany: {
|
|
55
|
+
level: 'permission',
|
|
56
|
+
permissions: [
|
|
57
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.CREATE
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
getById: {
|
|
61
|
+
level: 'permission',
|
|
62
|
+
permissions: [
|
|
63
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.READ
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
getAll: {
|
|
67
|
+
level: 'permission',
|
|
68
|
+
permissions: [
|
|
69
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.READ
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
update: {
|
|
73
|
+
level: 'permission',
|
|
74
|
+
permissions: [
|
|
75
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.UPDATE
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
updateMany: {
|
|
79
|
+
level: 'permission',
|
|
80
|
+
permissions: [
|
|
81
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.UPDATE
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
delete: {
|
|
85
|
+
level: 'permission',
|
|
86
|
+
permissions: [
|
|
87
|
+
_classes.EMAIL_TEMPLATE_PERMISSIONS.DELETE
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}) {
|
|
92
|
+
async getBySlug(body, user) {
|
|
93
|
+
const data = await this.emailTemplateService.findBySlug(body.slug, user);
|
|
51
94
|
return {
|
|
52
95
|
success: true,
|
|
53
|
-
|
|
96
|
+
message: 'Template retrieved',
|
|
97
|
+
data: data ?? undefined
|
|
54
98
|
};
|
|
55
99
|
}
|
|
56
100
|
constructor(emailTemplateService){
|
|
@@ -59,9 +103,16 @@ let EmailTemplateController = class EmailTemplateController extends (0, _classes
|
|
|
59
103
|
};
|
|
60
104
|
_ts_decorate([
|
|
61
105
|
(0, _common.Post)('get-by-slug'),
|
|
106
|
+
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
107
|
+
(0, _swagger.ApiBearerAuth)(),
|
|
108
|
+
(0, _decorators.RequirePermission)(_classes.EMAIL_TEMPLATE_PERMISSIONS.READ),
|
|
62
109
|
(0, _swagger.ApiOperation)({
|
|
63
110
|
summary: 'Get email template by slug'
|
|
64
111
|
}),
|
|
112
|
+
(0, _swagger.ApiResponse)({
|
|
113
|
+
status: 200,
|
|
114
|
+
type: _dtos.EmailTemplateResponseDto
|
|
115
|
+
}),
|
|
65
116
|
_ts_param(0, (0, _common.Body)()),
|
|
66
117
|
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
67
118
|
_ts_metadata("design:type", Function),
|
|
@@ -73,9 +124,7 @@ _ts_decorate([
|
|
|
73
124
|
], EmailTemplateController.prototype, "getBySlug", null);
|
|
74
125
|
EmailTemplateController = _ts_decorate([
|
|
75
126
|
(0, _swagger.ApiTags)('Email Template'),
|
|
76
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
77
127
|
(0, _common.Controller)('email/email-template'),
|
|
78
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
79
128
|
_ts_param(0, (0, _common.Inject)(_services.EmailTemplateService)),
|
|
80
129
|
_ts_metadata("design:type", Function),
|
|
81
130
|
_ts_metadata("design:paramtypes", [
|
|
@@ -22,102 +22,34 @@ Object.defineProperty(exports, "emailSwaggerConfig", {
|
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
];
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
description: enableCompanyFeature ? `
|
|
30
|
-
# Email Management API
|
|
31
|
-
|
|
32
|
-
Complete email management system with multi-tenant and company support.
|
|
33
|
-
|
|
34
|
-
## Features
|
|
35
|
-
|
|
36
|
-
### 📧 Email Configuration
|
|
37
|
-
- Multiple email providers (SMTP, SendGrid, Mailgun)
|
|
38
|
-
- Provider-specific configurations
|
|
39
|
-
- Default sender settings
|
|
40
|
-
- **Company-level email configs**
|
|
41
|
-
|
|
42
|
-
### 📝 Email Templates
|
|
43
|
-
- Visual template builder
|
|
44
|
-
- Variable interpolation ({{variable}})
|
|
45
|
-
- HTML and plain text support
|
|
46
|
-
- Template versioning
|
|
47
|
-
- **Company isolation**
|
|
48
|
-
|
|
49
|
-
### ✉️ Email Sending
|
|
50
|
-
- Direct email sending
|
|
51
|
-
- Template-based sending
|
|
52
|
-
- Attachments support
|
|
53
|
-
- CC/BCC recipients
|
|
54
|
-
|
|
55
|
-
### 🔒 Security
|
|
56
|
-
- JWT authentication required
|
|
57
|
-
- **Company isolation**
|
|
58
|
-
- Secure credential storage
|
|
59
|
-
|
|
60
|
-
## Supported Providers
|
|
61
|
-
|
|
62
|
-
### SMTP
|
|
63
|
-
- Universal email protocol
|
|
64
|
-
- Custom server support
|
|
65
|
-
- TLS/SSL encryption
|
|
66
|
-
|
|
67
|
-
### SendGrid (optional)
|
|
68
|
-
- Cloud email service
|
|
69
|
-
- High deliverability
|
|
70
|
-
- Install: \`npm install @sendgrid/mail\`
|
|
71
|
-
|
|
72
|
-
### Mailgun (optional)
|
|
73
|
-
- Developer-friendly API
|
|
74
|
-
- Detailed analytics
|
|
75
|
-
- Install: \`npm install mailgun.js\`
|
|
76
|
-
|
|
77
|
-
## Template Variables
|
|
78
|
-
|
|
79
|
-
Templates support Handlebars-style variables:
|
|
80
|
-
- \`{{userName}}\` - Simple variable
|
|
81
|
-
- \`{{user.email}}\` - Nested properties
|
|
82
|
-
- Variables are replaced at send time
|
|
83
|
-
|
|
25
|
+
function buildDescription(enableCompanyFeature) {
|
|
26
|
+
const companyConfigs = enableCompanyFeature ? '\n- **Company-level email configs**' : '';
|
|
27
|
+
const companyIsolation = enableCompanyFeature ? '\n- **Company isolation**' : '';
|
|
28
|
+
const multiTenantSection = enableCompanyFeature ? `
|
|
84
29
|
## Multi-Tenant Support
|
|
85
30
|
|
|
86
31
|
Emails are automatically isolated by:
|
|
87
32
|
- **Company ID**: Company-level templates and configs
|
|
88
33
|
|
|
89
34
|
All queries automatically filter by current user's company context.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
All email endpoints are prefixed with \`/email\`:
|
|
94
|
-
- \`/email/email-config/*\` - Email provider configurations
|
|
95
|
-
- \`/email/email-template/*\` - Email templates
|
|
96
|
-
- \`/email/email-send/*\` - Send emails
|
|
97
|
-
|
|
98
|
-
## Getting Started
|
|
99
|
-
|
|
100
|
-
1. **Authenticate**: Obtain JWT token from /auth/login
|
|
101
|
-
2. **Configure Provider**: Create email config via /email/email-config/insert
|
|
102
|
-
3. **Create Templates**: Add templates via /email/email-template/insert
|
|
103
|
-
4. **Send Emails**: Send via /email/email-send/send or /email/email-send/send-template
|
|
104
|
-
` : `
|
|
35
|
+
` : '';
|
|
36
|
+
return `
|
|
105
37
|
# Email Management API
|
|
106
38
|
|
|
107
|
-
Complete email management system.
|
|
39
|
+
Complete email management system${enableCompanyFeature ? ' with multi-tenant and company support' : ''}.
|
|
108
40
|
|
|
109
41
|
## Features
|
|
110
42
|
|
|
111
43
|
### 📧 Email Configuration
|
|
112
44
|
- Multiple email providers (SMTP, SendGrid, Mailgun)
|
|
113
45
|
- Provider-specific configurations
|
|
114
|
-
- Default sender settings
|
|
46
|
+
- Default sender settings${companyConfigs}
|
|
115
47
|
|
|
116
48
|
### 📝 Email Templates
|
|
117
49
|
- Visual template builder
|
|
118
50
|
- Variable interpolation ({{variable}})
|
|
119
51
|
- HTML and plain text support
|
|
120
|
-
- Template versioning
|
|
52
|
+
- Template versioning${companyIsolation}
|
|
121
53
|
|
|
122
54
|
### ✉️ Email Sending
|
|
123
55
|
- Direct email sending
|
|
@@ -126,7 +58,7 @@ Complete email management system.
|
|
|
126
58
|
- CC/BCC recipients
|
|
127
59
|
|
|
128
60
|
### 🔒 Security
|
|
129
|
-
- JWT authentication required
|
|
61
|
+
- JWT authentication required${companyIsolation}
|
|
130
62
|
- Secure credential storage
|
|
131
63
|
|
|
132
64
|
## Supported Providers
|
|
@@ -152,7 +84,7 @@ Templates support Handlebars-style variables:
|
|
|
152
84
|
- \`{{userName}}\` - Simple variable
|
|
153
85
|
- \`{{user.email}}\` - Nested properties
|
|
154
86
|
- Variables are replaced at send time
|
|
155
|
-
|
|
87
|
+
${multiTenantSection}
|
|
156
88
|
## API Endpoints
|
|
157
89
|
|
|
158
90
|
All email endpoints are prefixed with \`/email\`:
|
|
@@ -166,7 +98,13 @@ All email endpoints are prefixed with \`/email\`:
|
|
|
166
98
|
2. **Configure Provider**: Create email config via /email/email-config/insert
|
|
167
99
|
3. **Create Templates**: Add templates via /email/email-template/insert
|
|
168
100
|
4. **Send Emails**: Send via /email/email-send/send or /email/email-send/send-template
|
|
169
|
-
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
function emailSwaggerConfig(bootstrapConfig) {
|
|
104
|
+
const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
|
|
105
|
+
return {
|
|
106
|
+
title: 'Email API',
|
|
107
|
+
description: buildDescription(enableCompanyFeature),
|
|
170
108
|
version: '1.0',
|
|
171
109
|
path: 'api/docs/email',
|
|
172
110
|
bearerAuth: true,
|
|
@@ -68,8 +68,7 @@ _ts_decorate([
|
|
|
68
68
|
_ts_decorate([
|
|
69
69
|
(0, _swagger.ApiProperty)({
|
|
70
70
|
enum: _enums.EmailProviderTypeEnum,
|
|
71
|
-
example: _enums.EmailProviderTypeEnum.SMTP
|
|
72
|
-
description: 'Email provider type'
|
|
71
|
+
example: _enums.EmailProviderTypeEnum.SMTP
|
|
73
72
|
}),
|
|
74
73
|
(0, _classvalidator.IsEnum)(_enums.EmailProviderTypeEnum),
|
|
75
74
|
(0, _classvalidator.IsNotEmpty)(),
|
|
@@ -78,38 +77,8 @@ _ts_decorate([
|
|
|
78
77
|
_ts_decorate([
|
|
79
78
|
(0, _swagger.ApiProperty)({
|
|
80
79
|
type: 'object',
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
type: 'string',
|
|
84
|
-
example: 'smtp.gmail.com',
|
|
85
|
-
description: 'SMTP host'
|
|
86
|
-
},
|
|
87
|
-
port: {
|
|
88
|
-
type: 'number',
|
|
89
|
-
example: 587,
|
|
90
|
-
description: 'SMTP port'
|
|
91
|
-
},
|
|
92
|
-
secure: {
|
|
93
|
-
type: 'boolean',
|
|
94
|
-
example: false,
|
|
95
|
-
description: 'Use TLS'
|
|
96
|
-
},
|
|
97
|
-
auth: {
|
|
98
|
-
type: 'object',
|
|
99
|
-
properties: {
|
|
100
|
-
user: {
|
|
101
|
-
type: 'string',
|
|
102
|
-
example: 'user@gmail.com'
|
|
103
|
-
},
|
|
104
|
-
pass: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
example: 'app-password'
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
additionalProperties: true,
|
|
112
|
-
description: 'Provider-specific configuration'
|
|
80
|
+
description: 'Provider-specific configuration (SMTP: host, port, secure, auth)',
|
|
81
|
+
additionalProperties: true
|
|
113
82
|
}),
|
|
114
83
|
(0, _classvalidator.IsObject)(),
|
|
115
84
|
(0, _classvalidator.IsNotEmpty)(),
|
|
@@ -149,16 +118,9 @@ _ts_decorate([
|
|
|
149
118
|
(0, _classvalidator.IsOptional)(),
|
|
150
119
|
_ts_metadata("design:type", Boolean)
|
|
151
120
|
], CreateEmailConfigDto.prototype, "isDefault", void 0);
|
|
152
|
-
let UpdateEmailConfigDto = class UpdateEmailConfigDto {
|
|
153
|
-
constructor(){
|
|
154
|
-
_define_property(this, "id", void 0);
|
|
155
|
-
_define_property(this, "name", void 0);
|
|
156
|
-
_define_property(this, "provider", void 0);
|
|
157
|
-
_define_property(this, "config", void 0);
|
|
158
|
-
_define_property(this, "fromEmail", void 0);
|
|
159
|
-
_define_property(this, "fromName", void 0);
|
|
160
|
-
_define_property(this, "isActive", void 0);
|
|
161
|
-
_define_property(this, "isDefault", void 0);
|
|
121
|
+
let UpdateEmailConfigDto = class UpdateEmailConfigDto extends (0, _swagger.PartialType)(CreateEmailConfigDto) {
|
|
122
|
+
constructor(...args){
|
|
123
|
+
super(...args), _define_property(this, "id", void 0);
|
|
162
124
|
}
|
|
163
125
|
};
|
|
164
126
|
_ts_decorate([
|
|
@@ -169,68 +131,6 @@ _ts_decorate([
|
|
|
169
131
|
(0, _classvalidator.IsNotEmpty)(),
|
|
170
132
|
_ts_metadata("design:type", String)
|
|
171
133
|
], UpdateEmailConfigDto.prototype, "id", void 0);
|
|
172
|
-
_ts_decorate([
|
|
173
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
174
|
-
example: 'Production SMTP'
|
|
175
|
-
}),
|
|
176
|
-
(0, _classvalidator.IsString)(),
|
|
177
|
-
(0, _classvalidator.IsOptional)(),
|
|
178
|
-
(0, _classvalidator.MaxLength)(255),
|
|
179
|
-
_ts_metadata("design:type", String)
|
|
180
|
-
], UpdateEmailConfigDto.prototype, "name", void 0);
|
|
181
|
-
_ts_decorate([
|
|
182
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
183
|
-
enum: _enums.EmailProviderTypeEnum,
|
|
184
|
-
example: _enums.EmailProviderTypeEnum.SMTP
|
|
185
|
-
}),
|
|
186
|
-
(0, _classvalidator.IsEnum)(_enums.EmailProviderTypeEnum),
|
|
187
|
-
(0, _classvalidator.IsOptional)(),
|
|
188
|
-
_ts_metadata("design:type", typeof _enums.EmailProviderTypeEnum === "undefined" ? Object : _enums.EmailProviderTypeEnum)
|
|
189
|
-
], UpdateEmailConfigDto.prototype, "provider", void 0);
|
|
190
|
-
_ts_decorate([
|
|
191
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
192
|
-
type: 'object',
|
|
193
|
-
additionalProperties: true,
|
|
194
|
-
description: 'Provider-specific configuration'
|
|
195
|
-
}),
|
|
196
|
-
(0, _classvalidator.IsObject)(),
|
|
197
|
-
(0, _classvalidator.IsOptional)(),
|
|
198
|
-
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
199
|
-
], UpdateEmailConfigDto.prototype, "config", void 0);
|
|
200
|
-
_ts_decorate([
|
|
201
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
202
|
-
example: 'noreply@example.com'
|
|
203
|
-
}),
|
|
204
|
-
(0, _classvalidator.IsEmail)(),
|
|
205
|
-
(0, _classvalidator.IsOptional)(),
|
|
206
|
-
_ts_metadata("design:type", String)
|
|
207
|
-
], UpdateEmailConfigDto.prototype, "fromEmail", void 0);
|
|
208
|
-
_ts_decorate([
|
|
209
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
210
|
-
example: 'FLUSYS'
|
|
211
|
-
}),
|
|
212
|
-
(0, _classvalidator.IsString)(),
|
|
213
|
-
(0, _classvalidator.IsOptional)(),
|
|
214
|
-
(0, _classvalidator.MaxLength)(255),
|
|
215
|
-
_ts_metadata("design:type", String)
|
|
216
|
-
], UpdateEmailConfigDto.prototype, "fromName", void 0);
|
|
217
|
-
_ts_decorate([
|
|
218
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
219
|
-
example: true
|
|
220
|
-
}),
|
|
221
|
-
(0, _classvalidator.IsBoolean)(),
|
|
222
|
-
(0, _classvalidator.IsOptional)(),
|
|
223
|
-
_ts_metadata("design:type", Boolean)
|
|
224
|
-
], UpdateEmailConfigDto.prototype, "isActive", void 0);
|
|
225
|
-
_ts_decorate([
|
|
226
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
227
|
-
example: false,
|
|
228
|
-
description: 'Set as default email configuration'
|
|
229
|
-
}),
|
|
230
|
-
(0, _classvalidator.IsBoolean)(),
|
|
231
|
-
(0, _classvalidator.IsOptional)(),
|
|
232
|
-
_ts_metadata("design:type", Boolean)
|
|
233
|
-
], UpdateEmailConfigDto.prototype, "isDefault", void 0);
|
|
234
134
|
let EmailConfigResponseDto = class EmailConfigResponseDto extends _dtos.IdentityResponseDto {
|
|
235
135
|
constructor(...args){
|
|
236
136
|
super(...args), _define_property(this, "name", void 0), _define_property(this, "provider", void 0), _define_property(this, "config", void 0), _define_property(this, "fromEmail", void 0), _define_property(this, "fromName", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0);
|