phx-node 1.0.188 → 1.0.189
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.
|
@@ -28,6 +28,13 @@ export interface RequiredActionV2 {
|
|
|
28
28
|
task_target_id: string;
|
|
29
29
|
due_date?: string;
|
|
30
30
|
}
|
|
31
|
+
export interface CompleteRequiredActionV2 {
|
|
32
|
+
hostname: string;
|
|
33
|
+
user_id: number;
|
|
34
|
+
app?: string;
|
|
35
|
+
action_code: string;
|
|
36
|
+
task_target_id: string;
|
|
37
|
+
}
|
|
31
38
|
export interface PushInappNotiV2 {
|
|
32
39
|
hostname: string;
|
|
33
40
|
send_to_user_id: number;
|
|
@@ -60,8 +67,13 @@ export declare class PHXPushNotificationServiceV2 {
|
|
|
60
67
|
private readonly logger;
|
|
61
68
|
constructor(httpService: HttpService, configService: ConfigService);
|
|
62
69
|
private pushNoti;
|
|
70
|
+
private complete;
|
|
63
71
|
send(payload: PushInappNotiV2): Promise<{
|
|
64
72
|
status: string;
|
|
65
73
|
message: string;
|
|
66
74
|
}>;
|
|
75
|
+
completeRequireAction(payload: CompleteRequiredActionV2): Promise<{
|
|
76
|
+
status: string;
|
|
77
|
+
message: string;
|
|
78
|
+
}>;
|
|
67
79
|
}
|
|
@@ -69,6 +69,32 @@ let PHXPushNotificationServiceV2 = PHXPushNotificationServiceV2_1 = class PHXPus
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
complete(_a) {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* ({ payload }) {
|
|
74
|
+
var _b, _c;
|
|
75
|
+
const { hostname } = payload;
|
|
76
|
+
const producerApi = this.configService.get("PRODUCER_API");
|
|
77
|
+
if (!producerApi) {
|
|
78
|
+
const errorMessage = `${hostname}: PRODUCER_API is not configured`;
|
|
79
|
+
this.logger.debug(errorMessage);
|
|
80
|
+
throw new Error(errorMessage);
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const { data } = yield (0, rxjs_1.lastValueFrom)(this.httpService.post(`${producerApi}/emit/inapp-noti/complete-require-action`, payload, { headers: { hostname } }));
|
|
84
|
+
return data;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
let errorMessage = "";
|
|
88
|
+
if ((_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) {
|
|
89
|
+
const message = error.response.data.message;
|
|
90
|
+
errorMessage = Array.isArray(message) ? message.join(", ") : message;
|
|
91
|
+
}
|
|
92
|
+
const errorResponse = `Error complete require action: ${errorMessage}`;
|
|
93
|
+
this.logger.error(errorResponse);
|
|
94
|
+
throw new Error(errorResponse);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
72
98
|
send(payload) {
|
|
73
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
100
|
try {
|
|
@@ -80,6 +106,17 @@ let PHXPushNotificationServiceV2 = PHXPushNotificationServiceV2_1 = class PHXPus
|
|
|
80
106
|
}
|
|
81
107
|
});
|
|
82
108
|
}
|
|
109
|
+
completeRequireAction(payload) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
try {
|
|
112
|
+
yield this.complete({ payload });
|
|
113
|
+
return { status: "success", message: "Action completed successfully" };
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
throw new common_1.BadRequestException((error === null || error === void 0 ? void 0 : error.message) || "Failed to complete action");
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
83
120
|
};
|
|
84
121
|
exports.PHXPushNotificationServiceV2 = PHXPushNotificationServiceV2;
|
|
85
122
|
exports.PHXPushNotificationServiceV2 = PHXPushNotificationServiceV2 = PHXPushNotificationServiceV2_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-notification-v2.service.js","sourceRoot":"","sources":["../../../src/module/inapp-noti/push-notification-v2.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAAyE;AACzE,2CAA+C;AAC/C,+BAAqC;
|
|
1
|
+
{"version":3,"file":"push-notification-v2.service.js","sourceRoot":"","sources":["../../../src/module/inapp-noti/push-notification-v2.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA4C;AAC5C,2CAAyE;AACzE,2CAA+C;AAC/C,+BAAqC;AAmE9B,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAGvC,YACmB,WAAwB,EACxB,aAA4B;QAD5B,gBAAW,GAAX,WAAW,CAAa;QACxB,kBAAa,GAAb,aAAa,CAAe;QAJ9B,WAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC,IAAI,CAAC,CAAC;IAKrE,CAAC;IAEU,QAAQ,CAAC,OAAwB;;;YAC7C,MAAM,EAAE,QAAQ,KAAa,OAAO,EAAf,GAAG,UAAK,OAAO,EAA9B,YAAoB,CAAU,CAAC;YACrC,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,YAAY,GAAG,GAAG,QAAQ,kCAAkC,CAAC;gBACnE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,oBAAa,EAClC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,qBAAqB,EAAE,GAAG,EAAE;oBAC9D,OAAO,EAAE,EAAE,QAAQ,EAAE;iBACtB,CAAC,CACH,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gB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