rez_core 2.2.197 → 2.2.198
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/dist/module/communication/controller/communication.controller.d.ts +1 -1
- package/dist/module/communication/controller/communication.controller.js +1 -1
- package/dist/module/communication/controller/communication.controller.js.map +1 -1
- package/dist/module/communication/dto/create-config.dto.d.ts +1 -2
- package/dist/module/communication/dto/create-config.dto.js +1 -6
- package/dist/module/communication/dto/create-config.dto.js.map +1 -1
- package/dist/module/communication/service/communication.service.d.ts +1 -1
- package/dist/module/communication/service/communication.service.js +5 -13
- package/dist/module/communication/service/communication.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/communication/controller/communication.controller.ts +2 -7
- package/src/module/communication/dto/create-config.dto.ts +1 -5
- package/src/module/communication/service/communication.service.ts +15 -29
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Param,
|
|
9
9
|
ParseIntPipe,
|
|
10
10
|
Post,
|
|
11
|
-
Put,
|
|
12
11
|
Query,
|
|
13
12
|
} from '@nestjs/common';
|
|
14
13
|
import { CommunicationService } from '../service/communication.service';
|
|
@@ -18,10 +17,9 @@ import {
|
|
|
18
17
|
GenericSendMessageDto,
|
|
19
18
|
GmailOAuthInitDto,
|
|
20
19
|
OutlookOAuthInitDto,
|
|
21
|
-
SendGridVerifiedSendersDto,
|
|
22
20
|
SendGridTemplatesDto,
|
|
21
|
+
SendGridVerifiedSendersDto,
|
|
23
22
|
UpdateConfigDto,
|
|
24
|
-
UpdateConfigStatusDto,
|
|
25
23
|
} from '../dto/create-config.dto';
|
|
26
24
|
|
|
27
25
|
export class ScheduledMessageDto extends GenericSendMessageDto {
|
|
@@ -232,10 +230,7 @@ export class CommunicationController {
|
|
|
232
230
|
@Post('sendgrid/verified-senders')
|
|
233
231
|
@HttpCode(HttpStatus.OK)
|
|
234
232
|
async getSendGridVerifiedSenders(@Body() dto: SendGridVerifiedSendersDto) {
|
|
235
|
-
return this.communicationService.getSendGridVerifiedSenders(
|
|
236
|
-
dto.levelId,
|
|
237
|
-
dto.levelType,
|
|
238
|
-
);
|
|
233
|
+
return this.communicationService.getSendGridVerifiedSenders(dto.apiKey);
|
|
239
234
|
}
|
|
240
235
|
|
|
241
236
|
@Post('sendgrid/templates')
|
|
@@ -324,13 +324,9 @@ export class OutlookOAuthInitDto {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
export class SendGridVerifiedSendersDto {
|
|
327
|
-
@IsNotEmpty()
|
|
328
|
-
@IsNumber()
|
|
329
|
-
levelId: number;
|
|
330
|
-
|
|
331
327
|
@IsNotEmpty()
|
|
332
328
|
@IsString()
|
|
333
|
-
|
|
329
|
+
apiKey: string;
|
|
334
330
|
}
|
|
335
331
|
|
|
336
332
|
export class SendGridTemplatesDto {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import {
|
|
3
|
+
import { Not, Repository } from 'typeorm';
|
|
4
4
|
import { ConfigService } from '@nestjs/config';
|
|
5
5
|
import { google } from 'googleapis';
|
|
6
6
|
import {
|
|
@@ -1467,7 +1467,8 @@ export class CommunicationService {
|
|
|
1467
1467
|
excludeHubId?: number,
|
|
1468
1468
|
): Promise<void> {
|
|
1469
1469
|
// Find all active configurations of the same type for this level
|
|
1470
|
-
const query = this.hubRepository
|
|
1470
|
+
const query = this.hubRepository
|
|
1471
|
+
.createQueryBuilder('hub')
|
|
1471
1472
|
.where('hub.level_id = :levelId', { levelId })
|
|
1472
1473
|
.andWhere('hub.level_type = :levelType', { levelType })
|
|
1473
1474
|
.andWhere('hub.communication_config_type = :configType', { configType })
|
|
@@ -1490,7 +1491,7 @@ export class CommunicationService {
|
|
|
1490
1491
|
status: 1,
|
|
1491
1492
|
...(excludeHubId && { id: Not(excludeHubId) }),
|
|
1492
1493
|
},
|
|
1493
|
-
{ status: 0 } // Deactivate
|
|
1494
|
+
{ status: 0 }, // Deactivate
|
|
1494
1495
|
);
|
|
1495
1496
|
|
|
1496
1497
|
this.logger.log(
|
|
@@ -1875,11 +1876,15 @@ export class CommunicationService {
|
|
|
1875
1876
|
}> {
|
|
1876
1877
|
try {
|
|
1877
1878
|
// Find active SendGrid configurations for this level
|
|
1878
|
-
const hubs = await this.getActiveHubs(
|
|
1879
|
-
|
|
1879
|
+
const hubs = await this.getActiveHubs(
|
|
1880
|
+
levelId,
|
|
1881
|
+
levelType,
|
|
1882
|
+
CommunicationConfigType.EMAIL,
|
|
1883
|
+
);
|
|
1884
|
+
|
|
1880
1885
|
// Look for SendGrid provider
|
|
1881
|
-
const sendGridHub = hubs.find(hub => hub.provider === 'sendgrid');
|
|
1882
|
-
|
|
1886
|
+
const sendGridHub = hubs.find((hub) => hub.provider === 'sendgrid');
|
|
1887
|
+
|
|
1883
1888
|
if (!sendGridHub) {
|
|
1884
1889
|
return {
|
|
1885
1890
|
success: false,
|
|
@@ -1889,7 +1894,7 @@ export class CommunicationService {
|
|
|
1889
1894
|
|
|
1890
1895
|
// Extract API key from configuration
|
|
1891
1896
|
const apiKey = sendGridHub.config?.config_json?.apiKey;
|
|
1892
|
-
|
|
1897
|
+
|
|
1893
1898
|
if (!apiKey) {
|
|
1894
1899
|
return {
|
|
1895
1900
|
success: false,
|
|
@@ -1911,10 +1916,7 @@ export class CommunicationService {
|
|
|
1911
1916
|
}
|
|
1912
1917
|
}
|
|
1913
1918
|
|
|
1914
|
-
async getSendGridVerifiedSenders(
|
|
1915
|
-
levelId: number,
|
|
1916
|
-
levelType: string,
|
|
1917
|
-
): Promise<{
|
|
1919
|
+
async getSendGridVerifiedSenders(apiKey: string): Promise<{
|
|
1918
1920
|
success: boolean;
|
|
1919
1921
|
data?: Array<{
|
|
1920
1922
|
label: string;
|
|
@@ -1923,22 +1925,6 @@ export class CommunicationService {
|
|
|
1923
1925
|
error?: string;
|
|
1924
1926
|
}> {
|
|
1925
1927
|
try {
|
|
1926
|
-
// Find active SendGrid configurations for this level
|
|
1927
|
-
const hubs = await this.getActiveHubs(levelId, levelType, CommunicationConfigType.EMAIL);
|
|
1928
|
-
|
|
1929
|
-
// Look for SendGrid provider
|
|
1930
|
-
const sendGridHub = hubs.find(hub => hub.provider === 'sendgrid');
|
|
1931
|
-
|
|
1932
|
-
if (!sendGridHub) {
|
|
1933
|
-
return {
|
|
1934
|
-
success: false,
|
|
1935
|
-
error: 'No active SendGrid configuration found for this level',
|
|
1936
|
-
};
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
// Extract API key from configuration
|
|
1940
|
-
const apiKey = sendGridHub.config?.config_json?.apiKey;
|
|
1941
|
-
|
|
1942
1928
|
if (!apiKey) {
|
|
1943
1929
|
return {
|
|
1944
1930
|
success: false,
|
|
@@ -1950,7 +1936,7 @@ export class CommunicationService {
|
|
|
1950
1936
|
return this.sendGridApiStrategy.getVerifiedSenders(apiKey);
|
|
1951
1937
|
} catch (error) {
|
|
1952
1938
|
this.logger.error(
|
|
1953
|
-
`Error fetching SendGrid verified senders
|
|
1939
|
+
`Error fetching SendGrid verified senders`,
|
|
1954
1940
|
error.message,
|
|
1955
1941
|
);
|
|
1956
1942
|
return {
|