@mbc-cqrs-serverless/survey-template
Version:
63 lines • 3.38 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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SurveyTemplateModule = void 0;
const core_1 = require("@mbc-cqrs-serverless/core");
const common_1 = require("@nestjs/common");
const survey_answer_rds_handler_1 = require("./handler/survey-answer-rds.handler");
const survey_template_rds_handler_1 = require("./handler/survey-template-rds.handler");
const survey_answer_controller_1 = require("./survey-answer.controller");
const survey_answer_service_1 = require("./survey-answer.service");
const survey_template_controller_1 = require("./survey-template.controller");
const survey_template_module_definition_1 = require("./survey-template.module-definition");
const survey_template_service_1 = require("./survey-template.service");
let SurveyTemplateModule = class SurveyTemplateModule extends survey_template_module_definition_1.ConfigurableModuleClass {
static register(options) {
const module = super.register(options);
if (options.enableController) {
if (!options.prismaService) {
throw new Error('PrismaService must be provided when enableController is true.');
}
if (!module.controllers) {
module.controllers = [];
}
module.controllers.push(survey_template_controller_1.SurveyTemplateController, survey_answer_controller_1.SurveyAnswerController);
if (!module.providers) {
module.providers = [];
}
module.providers.push({
provide: survey_template_module_definition_1.PRISMA_SERVICE,
useExisting: options.prismaService,
});
if (!module.imports) {
module.imports = [];
}
const imports = [...(module.imports ?? [])];
imports.push(core_1.CommandModule.register({
tableName: 'survey',
dataSyncHandlers: options?.dataSyncHandlers ?? [
survey_template_rds_handler_1.SurveyTemplateDataSyncRdsHandler,
survey_answer_rds_handler_1.SurveyAnswerDataSyncRdsHandler,
],
}));
return {
...module,
imports,
};
}
}
};
exports.SurveyTemplateModule = SurveyTemplateModule;
exports.SurveyTemplateModule = SurveyTemplateModule = __decorate([
(0, common_1.Module)({
imports: [core_1.DataStoreModule, core_1.QueueModule],
providers: [survey_template_service_1.SurveyTemplateService, survey_answer_service_1.SurveyAnswerService],
exports: [survey_template_service_1.SurveyTemplateService, survey_answer_service_1.SurveyAnswerService],
})
], SurveyTemplateModule);
//# sourceMappingURL=survey-template.module.js.map