@ngn-net/giftcard-shared
Version:
Shared library for gifts score microservices
73 lines • 3.15 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationService = exports.NotificationRabbitApi = void 0;
const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
const common_1 = require("@nestjs/common");
exports.NotificationRabbitApi = {
exchange: "notification",
type: "topic",
routingKeys: {
sendEmail: {
key: "sendEmail",
},
sendSms: {
key: "sendSms",
},
},
};
let NotificationService = class NotificationService {
async sendEmail(dto) {
return this.rabbit.publish(exports.NotificationRabbitApi.exchange, exports.NotificationRabbitApi.routingKeys.sendEmail.key, dto);
}
sendSms(msisdn) {
const rabbit = this.rabbit;
return {
async MastercardPreOrder() {
return rabbit.publish(exports.NotificationRabbitApi.exchange, exports.NotificationRabbitApi.routingKeys.sendSms.key, {
code: 3,
msisdn,
contents: {},
});
},
async MastercardDelivered(dto) {
return rabbit.publish(exports.NotificationRabbitApi.exchange, exports.NotificationRabbitApi.routingKeys.sendSms.key, {
code: 4,
msisdn,
contents: dto,
});
},
async OrderInvoice(dto) {
return rabbit.publish(exports.NotificationRabbitApi.exchange, exports.NotificationRabbitApi.routingKeys.sendSms.key, {
code: 2,
msisdn,
contents: dto,
});
},
async OrderCreation(dto) {
return rabbit.publish(exports.NotificationRabbitApi.exchange, exports.NotificationRabbitApi.routingKeys.sendSms.key, {
code: 1,
msisdn,
contents: dto,
});
},
};
}
};
exports.NotificationService = NotificationService;
__decorate([
(0, common_1.Inject)(),
__metadata("design:type", nestjs_rabbitmq_1.AmqpConnection)
], NotificationService.prototype, "rabbit", void 0);
exports.NotificationService = NotificationService = __decorate([
(0, common_1.Injectable)()
], NotificationService);
//# sourceMappingURL=notification.service.js.map