@yolo-croket-dev/amqp-access 0.7.362 → 0.7.364

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.
@@ -27,6 +27,7 @@ exports.AmqpNotificationServiceModule = AmqpNotificationServiceModule = __decora
27
27
  services_1.AmqpSendNotificationService,
28
28
  services_1.AmqpNotificationBulkSendService,
29
29
  services_1.AmqpAmplitudeCohortExportJobService,
30
+ services_1.AmqpNotificationCampaignService,
30
31
  ],
31
32
  exports: [
32
33
  amqp_notification_service_provider_1.NotifiactionServiceProvider,
@@ -39,6 +40,7 @@ exports.AmqpNotificationServiceModule = AmqpNotificationServiceModule = __decora
39
40
  services_1.AmqpSendNotificationService,
40
41
  services_1.AmqpNotificationBulkSendService,
41
42
  services_1.AmqpAmplitudeCohortExportJobService,
43
+ services_1.AmqpNotificationCampaignService,
42
44
  ],
43
45
  })
44
46
  ], AmqpNotificationServiceModule);
@@ -3,3 +3,4 @@ export * from './app-bulk-push-log';
3
3
  export * from './notification';
4
4
  export * from './notification-bulk-send';
5
5
  export * from './amplitude-cohort-export-job';
6
+ export * from './notification-campaign';
@@ -19,3 +19,4 @@ __exportStar(require("./app-bulk-push-log"), exports);
19
19
  __exportStar(require("./notification"), exports);
20
20
  __exportStar(require("./notification-bulk-send"), exports);
21
21
  __exportStar(require("./amplitude-cohort-export-job"), exports);
22
+ __exportStar(require("./notification-campaign"), exports);
@@ -0,0 +1,50 @@
1
+ import { NotificationCampaignMessage, NotificationCampaignStatus } from '@yolo-croket-dev/entity-v2';
2
+ /**
3
+ * @author jun
4
+ * @description 시트에서 확정된 개인별 메시지 계약
5
+ * @process 경계 검증 후 notification-service에 전달
6
+ */
7
+ export declare class NotificationCampaignMessagePayload implements NotificationCampaignMessage {
8
+ userId: string;
9
+ itemId: string;
10
+ couponCode: string;
11
+ pushTitle: string;
12
+ pushBody: string;
13
+ pushAppLink: string;
14
+ pushWebLink: string;
15
+ pushImage: string;
16
+ }
17
+ export declare class GetNotificationCampaignPayload {
18
+ campaignId: string;
19
+ afterUserId?: string;
20
+ }
21
+ export declare class RegisterNotificationCampaignPayload {
22
+ campaignId: string;
23
+ snapshotHash: string;
24
+ startsAt: string;
25
+ endsAt: string;
26
+ recipients: NotificationCampaignMessagePayload[];
27
+ }
28
+ export declare class SendNotificationCampaignPayload {
29
+ campaignId: string;
30
+ userId: string;
31
+ snapshotHash: string;
32
+ }
33
+ export interface NotificationCampaignRecipientResult {
34
+ userId: string;
35
+ itemId: string;
36
+ couponCode: string;
37
+ snapshotHash: string;
38
+ messageHash: string;
39
+ status: NotificationCampaignStatus;
40
+ reason: string;
41
+ providerRequestId?: string;
42
+ updatedAt: string;
43
+ }
44
+ export interface RegisterNotificationCampaignResult {
45
+ registered: number;
46
+ }
47
+ export interface GetNotificationCampaignResult {
48
+ recipients: NotificationCampaignRecipientResult[];
49
+ nextUserId?: string;
50
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SendNotificationCampaignPayload = exports.RegisterNotificationCampaignPayload = exports.GetNotificationCampaignPayload = exports.NotificationCampaignMessagePayload = void 0;
13
+ const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
+ /**
16
+ * @author jun
17
+ * @description 시트에서 확정된 개인별 메시지 계약
18
+ * @process 경계 검증 후 notification-service에 전달
19
+ */
20
+ class NotificationCampaignMessagePayload {
21
+ }
22
+ exports.NotificationCampaignMessagePayload = NotificationCampaignMessagePayload;
23
+ __decorate([
24
+ (0, class_validator_1.IsMongoId)(),
25
+ __metadata("design:type", String)
26
+ ], NotificationCampaignMessagePayload.prototype, "userId", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsMongoId)(),
29
+ __metadata("design:type", String)
30
+ ], NotificationCampaignMessagePayload.prototype, "itemId", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsString)(),
33
+ (0, class_validator_1.MinLength)(1),
34
+ (0, class_validator_1.MaxLength)(100),
35
+ __metadata("design:type", String)
36
+ ], NotificationCampaignMessagePayload.prototype, "couponCode", void 0);
37
+ __decorate([
38
+ (0, class_validator_1.IsString)(),
39
+ (0, class_validator_1.MinLength)(1),
40
+ (0, class_validator_1.MaxLength)(100),
41
+ __metadata("design:type", String)
42
+ ], NotificationCampaignMessagePayload.prototype, "pushTitle", void 0);
43
+ __decorate([
44
+ (0, class_validator_1.IsString)(),
45
+ (0, class_validator_1.MinLength)(1),
46
+ (0, class_validator_1.MaxLength)(500),
47
+ __metadata("design:type", String)
48
+ ], NotificationCampaignMessagePayload.prototype, "pushBody", void 0);
49
+ __decorate([
50
+ (0, class_validator_1.Matches)(/^yeogoo:\/\//),
51
+ (0, class_validator_1.MaxLength)(1500),
52
+ __metadata("design:type", String)
53
+ ], NotificationCampaignMessagePayload.prototype, "pushAppLink", void 0);
54
+ __decorate([
55
+ (0, class_validator_1.Matches)(/^https:\/\//),
56
+ (0, class_validator_1.MaxLength)(1500),
57
+ __metadata("design:type", String)
58
+ ], NotificationCampaignMessagePayload.prototype, "pushWebLink", void 0);
59
+ __decorate([
60
+ (0, class_validator_1.Matches)(/^https:\/\//),
61
+ (0, class_validator_1.MaxLength)(1500),
62
+ __metadata("design:type", String)
63
+ ], NotificationCampaignMessagePayload.prototype, "pushImage", void 0);
64
+ class GetNotificationCampaignPayload {
65
+ }
66
+ exports.GetNotificationCampaignPayload = GetNotificationCampaignPayload;
67
+ __decorate([
68
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
69
+ __metadata("design:type", String)
70
+ ], GetNotificationCampaignPayload.prototype, "campaignId", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.IsOptional)(),
73
+ (0, class_validator_1.IsMongoId)(),
74
+ __metadata("design:type", String)
75
+ ], GetNotificationCampaignPayload.prototype, "afterUserId", void 0);
76
+ class RegisterNotificationCampaignPayload {
77
+ }
78
+ exports.RegisterNotificationCampaignPayload = RegisterNotificationCampaignPayload;
79
+ __decorate([
80
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
81
+ __metadata("design:type", String)
82
+ ], RegisterNotificationCampaignPayload.prototype, "campaignId", void 0);
83
+ __decorate([
84
+ (0, class_validator_1.Matches)(/^[a-f0-9]{64}$/),
85
+ __metadata("design:type", String)
86
+ ], RegisterNotificationCampaignPayload.prototype, "snapshotHash", void 0);
87
+ __decorate([
88
+ (0, class_validator_1.IsISO8601)({ strict: true }),
89
+ (0, class_validator_1.Matches)(/(Z|[+-]\d{2}:\d{2})$/),
90
+ __metadata("design:type", String)
91
+ ], RegisterNotificationCampaignPayload.prototype, "startsAt", void 0);
92
+ __decorate([
93
+ (0, class_validator_1.IsISO8601)({ strict: true }),
94
+ (0, class_validator_1.Matches)(/(Z|[+-]\d{2}:\d{2})$/),
95
+ __metadata("design:type", String)
96
+ ], RegisterNotificationCampaignPayload.prototype, "endsAt", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsArray)(),
99
+ (0, class_validator_1.ArrayMinSize)(1),
100
+ (0, class_validator_1.ArrayMaxSize)(100),
101
+ (0, class_validator_1.ValidateNested)({ each: true }),
102
+ (0, class_transformer_1.Type)(() => NotificationCampaignMessagePayload),
103
+ __metadata("design:type", Array)
104
+ ], RegisterNotificationCampaignPayload.prototype, "recipients", void 0);
105
+ class SendNotificationCampaignPayload {
106
+ }
107
+ exports.SendNotificationCampaignPayload = SendNotificationCampaignPayload;
108
+ __decorate([
109
+ (0, class_validator_1.Matches)(/^[a-z0-9][a-z0-9_-]{0,59}$/),
110
+ __metadata("design:type", String)
111
+ ], SendNotificationCampaignPayload.prototype, "campaignId", void 0);
112
+ __decorate([
113
+ (0, class_validator_1.IsMongoId)(),
114
+ __metadata("design:type", String)
115
+ ], SendNotificationCampaignPayload.prototype, "userId", void 0);
116
+ __decorate([
117
+ (0, class_validator_1.Matches)(/^[a-f0-9]{64}$/),
118
+ __metadata("design:type", String)
119
+ ], SendNotificationCampaignPayload.prototype, "snapshotHash", void 0);
@@ -0,0 +1,15 @@
1
+ import { ClientProxy } from '@nestjs/microservices';
2
+ import { AbstractParam } from '@yolo-croket-dev/core';
3
+ import { RegisterNotificationCampaignPayload, RegisterNotificationCampaignResult, SendNotificationCampaignPayload, NotificationCampaignRecipientResult, GetNotificationCampaignPayload, GetNotificationCampaignResult } from '../dto';
4
+ /**
5
+ * @author jun
6
+ * @description 운영 스크립트의 저빈도 순차 요청용 RPC client
7
+ * @process 등록/수신자 한 명 실행/결과 페이지 조회; 재시도는 서버의 저장 상태로 차단
8
+ */
9
+ export declare class AmqpNotificationCampaignService {
10
+ private readonly manager;
11
+ constructor(client: ClientProxy);
12
+ register(payload: RegisterNotificationCampaignPayload, param: AbstractParam): Promise<RegisterNotificationCampaignResult>;
13
+ send(payload: SendNotificationCampaignPayload, param: AbstractParam): Promise<NotificationCampaignRecipientResult>;
14
+ get(payload: GetNotificationCampaignPayload, param: AbstractParam): Promise<GetNotificationCampaignResult>;
15
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AmqpNotificationCampaignService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const microservices_1 = require("@nestjs/microservices");
18
+ const functions_1 = require("@yolo-croket-dev/core/functions");
19
+ /**
20
+ * @author jun
21
+ * @description 운영 스크립트의 저빈도 순차 요청용 RPC client
22
+ * @process 등록/수신자 한 명 실행/결과 페이지 조회; 재시도는 서버의 저장 상태로 차단
23
+ */
24
+ let AmqpNotificationCampaignService = class AmqpNotificationCampaignService {
25
+ constructor(client) {
26
+ this.manager = new functions_1.AmqpManagement(client);
27
+ }
28
+ register(payload, param) {
29
+ return this.manager.call('캠페인 등록', 'notification-campaign.register.recipients', payload, param, { isErrorThrowing: true });
30
+ }
31
+ send(payload, param) {
32
+ return this.manager.call('캠페인 수신자 발송', 'notification-campaign.send.recipient', payload, param, { isErrorThrowing: true });
33
+ }
34
+ get(payload, param) {
35
+ return this.manager.call('캠페인 결과 조회', 'notification-campaign.get.results', payload, param, { isErrorThrowing: true });
36
+ }
37
+ };
38
+ exports.AmqpNotificationCampaignService = AmqpNotificationCampaignService;
39
+ exports.AmqpNotificationCampaignService = AmqpNotificationCampaignService = __decorate([
40
+ (0, common_1.Injectable)(),
41
+ __param(0, (0, common_1.Inject)('NOTIFICATION_SERVICE_PROVIDER')),
42
+ __metadata("design:paramtypes", [microservices_1.ClientProxy])
43
+ ], AmqpNotificationCampaignService);
@@ -6,3 +6,4 @@ export * from './amqp.app-bulk-push.service';
6
6
  export * from './amqp.send-notification.service';
7
7
  export * from './amqp.notification-bulk-send.service';
8
8
  export * from './amqp.amplitude-cohort-export-job.service';
9
+ export * from './amqp.notification-campaign.service';
@@ -22,3 +22,4 @@ __exportStar(require("./amqp.app-bulk-push.service"), exports);
22
22
  __exportStar(require("./amqp.send-notification.service"), exports);
23
23
  __exportStar(require("./amqp.notification-bulk-send.service"), exports);
24
24
  __exportStar(require("./amqp.amplitude-cohort-export-job.service"), exports);
25
+ __exportStar(require("./amqp.notification-campaign.service"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/amqp-access",
3
- "version": "0.7.362",
3
+ "version": "0.7.364",
4
4
  "main": "index.js",
5
5
  "author": "Yolo Co., Ltd.",
6
6
  "description": "크로켓 amqp-access npm",
@@ -23,7 +23,7 @@
23
23
  "@yolo-croket-dev/domain": "0.2.50",
24
24
  "@yolo-croket-dev/dto-v2": "0.2.31",
25
25
  "@yolo-croket-dev/entity": "0.2.109",
26
- "@yolo-croket-dev/entity-v2": "0.3.54",
26
+ "@yolo-croket-dev/entity-v2": "0.3.55",
27
27
  "class-transformer": "^0.5.1",
28
28
  "class-validator": "^0.13.2",
29
29
  "dotenv": "^16.3.1"
@@ -2,10 +2,11 @@ import { EditAdCenterSettleBizMemoManageUserInfo } from './edit-ad-center-settle
2
2
  export declare const MAX_AD_CENTER_COUPON_RATE_UPDATES = 100;
3
3
  /**
4
4
  * @author 홍준
5
- * @description 광고센터 publicId 목록의 판매자 부담 할인율 변경 계약
5
+ * @description purchasedInfo.publicId 목록의 판매자 부담 할인율 변경 계약
6
6
  * @process 전체 할인율을 유지하고 입력한 두 부담 할인율을 저장하고 판매자 부담금을 재계산한다.
7
7
  */
8
8
  export declare class UpdateAdCenterCouponRatesPayload {
9
+ /** 주문의 purchasedInfo.publicId. 광고센터 정산 publicId나 MongoDB _id가 아니다. */
9
10
  publicIds: string[];
10
11
  /** 전체 할인율 중 판매자가 부담하는 할인율. 전체 할인율 10, 판매자 3이면 할인금액의 30%를 부담한다. */
11
12
  sellerRate: number;
@@ -16,6 +17,7 @@ export declare class UpdateAdCenterCouponRatesPayload {
16
17
  }
17
18
  /** @author 홍준 @description 주문과 광고센터 정산의 변경 전후 정보 @process 검증·재계산 결과를 반환한다. */
18
19
  export declare class UpdateAdCenterCouponRatesItemResult {
20
+ /** 조회에 사용한 purchasedInfo.publicId */
19
21
  publicId: string;
20
22
  pInfoId: string;
21
23
  allRate: number;
@@ -16,7 +16,7 @@ const edit_ad_center_settle_biz_memo_dto_1 = require("./edit-ad-center-settle-bi
16
16
  exports.MAX_AD_CENTER_COUPON_RATE_UPDATES = 100;
17
17
  /**
18
18
  * @author 홍준
19
- * @description 광고센터 publicId 목록의 판매자 부담 할인율 변경 계약
19
+ * @description purchasedInfo.publicId 목록의 판매자 부담 할인율 변경 계약
20
20
  * @process 전체 할인율을 유지하고 입력한 두 부담 할인율을 저장하고 판매자 부담금을 재계산한다.
21
21
  */
22
22
  class UpdateAdCenterCouponRatesPayload {
@@ -28,7 +28,9 @@ __decorate([
28
28
  (0, class_validator_1.ArrayMaxSize)(exports.MAX_AD_CENTER_COUPON_RATE_UPDATES),
29
29
  (0, class_validator_1.ArrayUnique)(),
30
30
  (0, class_validator_1.IsString)({ each: true }),
31
- (0, class_validator_1.Matches)(/^AD_\d{6}_[A-Z0-9]{4}$/, { each: true }),
31
+ (0, class_validator_1.Matches)(/^\S+$/, { each: true })
32
+ /** 주문의 purchasedInfo.publicId. 광고센터 정산 publicId나 MongoDB _id가 아니다. */
33
+ ,
32
34
  __metadata("design:type", Array)
33
35
  ], UpdateAdCenterCouponRatesPayload.prototype, "publicIds", void 0);
34
36
  __decorate([
@@ -6,7 +6,7 @@ export declare class AmqpAdCenterSettleService {
6
6
  private readonly client;
7
7
  private readonly amqpManager;
8
8
  constructor(client: ClientProxy);
9
- /** @author 홍준 @description publicId 목록의 쿠폰 분담율을 변경한다. @process 결제 서비스의 일괄 변경 RPC를 호출한다. */
9
+ /** @author 홍준 @description purchasedInfo.publicId 목록의 쿠폰 분담율을 변경한다. @process 결제 서비스의 일괄 변경 RPC를 호출한다. */
10
10
  updateAdCenterCouponRates(payload: UpdateAdCenterCouponRatesPayload, param: AbstractParam): Promise<UpdateAdCenterCouponRatesResult>;
11
11
  createAdCenterSettles(payload: CreateAdCenterSettlePayload, param: AbstractParam): Promise<CreateAdCenterSettleResult>;
12
12
  editAdCenterSettle(payload: EditAdCenterSettlePayload, param: AbstractParam): Promise<void>;
@@ -21,7 +21,7 @@ let AmqpAdCenterSettleService = class AmqpAdCenterSettleService {
21
21
  this.client = client;
22
22
  this.amqpManager = new functions_1.AmqpManagement(this.client);
23
23
  }
24
- /** @author 홍준 @description publicId 목록의 쿠폰 분담율을 변경한다. @process 결제 서비스의 일괄 변경 RPC를 호출한다. */
24
+ /** @author 홍준 @description purchasedInfo.publicId 목록의 쿠폰 분담율을 변경한다. @process 결제 서비스의 일괄 변경 RPC를 호출한다. */
25
25
  async updateAdCenterCouponRates(payload, param) {
26
26
  return this.amqpManager.call('광고센터 쿠폰 분담율 일괄 변경', 'ad-center-settle.update.coupon-rates', payload, param, { isErrorThrowing: true });
27
27
  }