@mbc-cqrs-serverless/survey-template 1.0.2
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/LICENSE.txt +7 -0
- package/README.md +44 -0
- package/dist/dto/index.d.ts +4 -0
- package/dist/dto/index.js +21 -0
- package/dist/dto/index.js.map +1 -0
- package/dist/dto/survey-template-attributes.dto.d.ts +4 -0
- package/dist/dto/survey-template-attributes.dto.js +57 -0
- package/dist/dto/survey-template-attributes.dto.js.map +1 -0
- package/dist/dto/survey-template-command.dto.d.ts +6 -0
- package/dist/dto/survey-template-command.dto.js +30 -0
- package/dist/dto/survey-template-command.dto.js.map +1 -0
- package/dist/dto/survey-template-create.dto.d.ts +6 -0
- package/dist/dto/survey-template-create.dto.js +43 -0
- package/dist/dto/survey-template-create.dto.js.map +1 -0
- package/dist/dto/survey-template-update.dto.d.ts +7 -0
- package/dist/dto/survey-template-update.dto.js +53 -0
- package/dist/dto/survey-template-update.dto.js.map +1 -0
- package/dist/entity/index.d.ts +3 -0
- package/dist/entity/index.js +20 -0
- package/dist/entity/index.js.map +1 -0
- package/dist/entity/survey-template-command.entity.d.ts +6 -0
- package/dist/entity/survey-template-command.entity.js +12 -0
- package/dist/entity/survey-template-command.entity.js.map +1 -0
- package/dist/entity/survey-template-data-list.entity.d.ts +6 -0
- package/dist/entity/survey-template-data-list.entity.js +27 -0
- package/dist/entity/survey-template-data-list.entity.js.map +1 -0
- package/dist/entity/survey-template-data.entity.d.ts +6 -0
- package/dist/entity/survey-template-data.entity.js +12 -0
- package/dist/entity/survey-template-data.entity.js.map +1 -0
- package/dist/handler/index.d.ts +1 -0
- package/dist/handler/index.js +18 -0
- package/dist/handler/index.js.map +1 -0
- package/dist/handler/survey-template-rds.handler.d.ts +8 -0
- package/dist/handler/survey-template-rds.handler.js +79 -0
- package/dist/handler/survey-template-rds.handler.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.js +5 -0
- package/dist/keys/index.js.map +1 -0
- package/dist/survey-template.controller.d.ts +15 -0
- package/dist/survey-template.controller.js +97 -0
- package/dist/survey-template.controller.js.map +1 -0
- package/dist/survey-template.module-definition.d.ts +9 -0
- package/dist/survey-template.module-definition.js +8 -0
- package/dist/survey-template.module-definition.js.map +1 -0
- package/dist/survey-template.module.d.ts +5 -0
- package/dist/survey-template.module.js +75 -0
- package/dist/survey-template.module.js.map +1 -0
- package/dist/survey-template.service.d.ts +23 -0
- package/dist/survey-template.service.js +166 -0
- package/dist/survey-template.service.js.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +37 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +48 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2024 Murakami Business Consulting, Inc. https://www.mbc-net.com/
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# MBC CQRS serverless framework Survey Template Service package
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
This package provides survey template management functionality in a multi-tenant CQRS architecture. It enables the creation, management, and storage of survey templates with support for:
|
|
8
|
+
|
|
9
|
+
- **Survey Template CRUD Operations**: Create, read, update, and delete survey templates
|
|
10
|
+
- **Multi-tenant Support**: Tenant-isolated survey template management
|
|
11
|
+
- **Flexible Survey Structure**: JSON-based survey template definitions supporting various question types
|
|
12
|
+
- **Search and Filtering**: Advanced search capabilities with keyword matching and filtering options
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **Survey Template Management**: Full lifecycle management of survey templates
|
|
17
|
+
- **Tenant Isolation**: Secure multi-tenant data separation
|
|
18
|
+
- **Flexible Schema**: Support for complex survey structures with sections and various question types
|
|
19
|
+
- **Search Capabilities**: Search by name, description, or other attributes
|
|
20
|
+
- **Event-Driven Architecture**: Built on CQRS pattern with command/event handling
|
|
21
|
+
- **RESTful API**: Complete REST API for survey template operations
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @mbc-cqrs-serverless/survey-template
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API Endpoints
|
|
30
|
+
|
|
31
|
+
- `GET /api/survey-template/` - Search and list survey templates
|
|
32
|
+
- `POST /api/survey-template/` - Create a new survey template
|
|
33
|
+
- `GET /api/survey-template/:id` - Get a specific survey template
|
|
34
|
+
- `PUT /api/survey-template/:id` - Update a survey template
|
|
35
|
+
- `DELETE /api/survey-template/:id` - Delete a survey template
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
Visit https://mbc-cqrs-serverless.mbc-net.com/ to view the full documentation.
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Copyright © 2024, Murakami Business Consulting, Inc. https://www.mbc-net.com/
|
|
44
|
+
This project and sub projects are under the MIT License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./survey-template-attributes.dto"), exports);
|
|
18
|
+
__exportStar(require("./survey-template-command.dto"), exports);
|
|
19
|
+
__exportStar(require("./survey-template-create.dto"), exports);
|
|
20
|
+
__exportStar(require("./survey-template-update.dto"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,gEAA6C;AAC7C,+DAA4C;AAC5C,+DAA4C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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.SurveyTemplateAttributes = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class SurveyTemplateAttributes {
|
|
16
|
+
}
|
|
17
|
+
exports.SurveyTemplateAttributes = SurveyTemplateAttributes;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({
|
|
20
|
+
description: 'Description of the survey template',
|
|
21
|
+
example: 'A comprehensive survey to measure customer satisfaction',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
(0, class_validator_1.IsString)(),
|
|
25
|
+
(0, class_validator_1.IsOptional)(),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], SurveyTemplateAttributes.prototype, "description", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({
|
|
30
|
+
description: 'The survey template structure as a JSON object',
|
|
31
|
+
example: {
|
|
32
|
+
id: 'svy_1759992461424',
|
|
33
|
+
title: 'Untitled Survey',
|
|
34
|
+
description: '',
|
|
35
|
+
items: [
|
|
36
|
+
{
|
|
37
|
+
id: 'sec_1759992461424',
|
|
38
|
+
type: 'section-header',
|
|
39
|
+
title: 'First Section',
|
|
40
|
+
description: '',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'q_1759992464085',
|
|
44
|
+
type: 'short-text',
|
|
45
|
+
label: '',
|
|
46
|
+
validation: {
|
|
47
|
+
required: false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
required: true,
|
|
53
|
+
}),
|
|
54
|
+
(0, class_validator_1.IsObject)(),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], SurveyTemplateAttributes.prototype, "surveyTemplate", void 0);
|
|
57
|
+
//# sourceMappingURL=survey-template-attributes.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-attributes.dto.js","sourceRoot":"","sources":["../../src/dto/survey-template-attributes.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,qDAAgE;AAEhE,MAAa,wBAAwB;CAqCpC;AArCD,4DAqCC;AA7BC;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,oCAAoC;QACjD,OAAO,EAAE,yDAAyD;QAClE,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6DACO;AA4BpB;IA1BC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE;YACP,EAAE,EAAE,mBAAmB;YACvB,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,EAAE;YACf,KAAK,EAAE;gBACL;oBACE,EAAE,EAAE,mBAAmB;oBACvB,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,eAAe;oBACtB,WAAW,EAAE,EAAE;iBAChB;gBACD;oBACE,EAAE,EAAE,iBAAiB;oBACrB,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,EAAE;oBACT,UAAU,EAAE;wBACV,QAAQ,EAAE,KAAK;qBAChB;iBACF;aACF;SACF;QACD,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,0BAAQ,GAAE;;gEACW"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommandDto } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateAttributes } from './survey-template-attributes.dto';
|
|
3
|
+
export declare class SurveyTemplateCommandDto extends CommandDto {
|
|
4
|
+
attributes: SurveyTemplateAttributes;
|
|
5
|
+
constructor(partial: Partial<SurveyTemplateCommandDto>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.SurveyTemplateCommandDto = void 0;
|
|
13
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const survey_template_attributes_dto_1 = require("./survey-template-attributes.dto");
|
|
17
|
+
class SurveyTemplateCommandDto extends core_1.CommandDto {
|
|
18
|
+
constructor(partial) {
|
|
19
|
+
super();
|
|
20
|
+
Object.assign(this, partial);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SurveyTemplateCommandDto = SurveyTemplateCommandDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_transformer_1.Type)(() => survey_template_attributes_dto_1.SurveyTemplateAttributes),
|
|
26
|
+
(0, class_validator_1.ValidateNested)(),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
__metadata("design:type", survey_template_attributes_dto_1.SurveyTemplateAttributes)
|
|
29
|
+
], SurveyTemplateCommandDto.prototype, "attributes", void 0);
|
|
30
|
+
//# sourceMappingURL=survey-template-command.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-command.dto.js","sourceRoot":"","sources":["../../src/dto/survey-template-command.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsD;AACtD,yDAAwC;AACxC,qDAA4D;AAE5D,qFAA2E;AAE3E,MAAa,wBAAyB,SAAQ,iBAAU;IAMtD,YAAY,OAA0C;QACpD,KAAK,EAAE,CAAA;QACP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAVD,4DAUC;AANC;IAHC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,yDAAwB,CAAC;IACpC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;8BACD,yDAAwB;4DAAA"}
|
|
@@ -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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SurveyTemplateCreateDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const survey_template_attributes_dto_1 = require("./survey-template-attributes.dto");
|
|
17
|
+
class SurveyTemplateCreateDto {
|
|
18
|
+
constructor(partial) {
|
|
19
|
+
Object.assign(this, partial);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SurveyTemplateCreateDto = SurveyTemplateCreateDto;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'Name of the survey template',
|
|
26
|
+
example: 'Customer Satisfaction Survey',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], SurveyTemplateCreateDto.prototype, "name", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({
|
|
35
|
+
description: 'Survey template attributes including description and survey template structure',
|
|
36
|
+
required: true,
|
|
37
|
+
}),
|
|
38
|
+
(0, class_transformer_1.Type)(() => survey_template_attributes_dto_1.SurveyTemplateAttributes),
|
|
39
|
+
(0, class_validator_1.ValidateNested)(),
|
|
40
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
41
|
+
__metadata("design:type", survey_template_attributes_dto_1.SurveyTemplateAttributes)
|
|
42
|
+
], SurveyTemplateCreateDto.prototype, "attributes", void 0);
|
|
43
|
+
//# sourceMappingURL=survey-template-create.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-create.dto.js","sourceRoot":"","sources":["../../src/dto/survey-template-create.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,yDAAwC;AACxC,qDAAsE;AAEtE,qFAA2E;AAE3E,MAAa,uBAAuB;IAoBlC,YAAY,OAAyC;QACnD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAvBD,0DAuBC;AAfC;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,8BAA8B;QACvC,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;qDACD;AAUZ;IARC,IAAA,qBAAW,EAAC;QACX,WAAW,EACT,gFAAgF;QAClF,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,yDAAwB,CAAC;IACpC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;8BACD,yDAAwB;2DAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SurveyTemplateAttributes } from './survey-template-attributes.dto';
|
|
2
|
+
export declare class SurveyTemplateUpdateDto {
|
|
3
|
+
name?: string;
|
|
4
|
+
isDeleted?: boolean;
|
|
5
|
+
attributes?: SurveyTemplateAttributes;
|
|
6
|
+
constructor(partial: Partial<SurveyTemplateUpdateDto>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.SurveyTemplateUpdateDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const survey_template_attributes_dto_1 = require("./survey-template-attributes.dto");
|
|
17
|
+
class SurveyTemplateUpdateDto {
|
|
18
|
+
constructor(partial) {
|
|
19
|
+
Object.assign(this, partial);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SurveyTemplateUpdateDto = SurveyTemplateUpdateDto;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({
|
|
25
|
+
description: 'Name of the survey template',
|
|
26
|
+
example: 'Customer Satisfaction Survey',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
(0, class_validator_1.IsString)(),
|
|
30
|
+
(0, class_validator_1.IsOptional)(),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], SurveyTemplateUpdateDto.prototype, "name", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({
|
|
35
|
+
description: 'Whether the survey template is deleted',
|
|
36
|
+
example: false,
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
(0, class_validator_1.IsBoolean)(),
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
__metadata("design:type", Boolean)
|
|
42
|
+
], SurveyTemplateUpdateDto.prototype, "isDeleted", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)({
|
|
45
|
+
description: 'Survey template attributes including description and survey template structure',
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
(0, class_transformer_1.Type)(() => survey_template_attributes_dto_1.SurveyTemplateAttributes),
|
|
49
|
+
(0, class_validator_1.ValidateNested)(),
|
|
50
|
+
(0, class_validator_1.IsOptional)(),
|
|
51
|
+
__metadata("design:type", survey_template_attributes_dto_1.SurveyTemplateAttributes)
|
|
52
|
+
], SurveyTemplateUpdateDto.prototype, "attributes", void 0);
|
|
53
|
+
//# sourceMappingURL=survey-template-update.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-update.dto.js","sourceRoot":"","sources":["../../src/dto/survey-template-update.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,yDAAwC;AACxC,qDAKwB;AAExB,qFAA2E;AAE3E,MAAa,uBAAuB;IA6BlC,YAAY,OAAyC;QACnD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AAhCD,0DAgCC;AAxBC;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,8BAA8B;QACvC,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;qDACA;AASb;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,2BAAS,GAAE;IACX,IAAA,4BAAU,GAAE;;0DACM;AAUnB;IARC,IAAA,qBAAW,EAAC;QACX,WAAW,EACT,gFAAgF;QAClF,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,yDAAwB,CAAC;IACpC,IAAA,gCAAc,GAAE;IAChB,IAAA,4BAAU,GAAE;8BACA,yDAAwB;2DAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./survey-template-command.entity"), exports);
|
|
18
|
+
__exportStar(require("./survey-template-data.entity"), exports);
|
|
19
|
+
__exportStar(require("./survey-template-data-list.entity"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,gEAA6C;AAC7C,qEAAkD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommandEntity } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateAttributes } from '../dto/survey-template-attributes.dto';
|
|
3
|
+
export declare class SurveyTemplateCommandEntity extends CommandEntity {
|
|
4
|
+
attributes: SurveyTemplateAttributes;
|
|
5
|
+
constructor(partial: Partial<SurveyTemplateCommandEntity>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SurveyTemplateCommandEntity = void 0;
|
|
4
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
5
|
+
class SurveyTemplateCommandEntity extends core_1.CommandEntity {
|
|
6
|
+
constructor(partial) {
|
|
7
|
+
super();
|
|
8
|
+
Object.assign(this, partial);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SurveyTemplateCommandEntity = SurveyTemplateCommandEntity;
|
|
12
|
+
//# sourceMappingURL=survey-template-command.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-command.entity.js","sourceRoot":"","sources":["../../src/entity/survey-template-command.entity.ts"],"names":[],"mappings":";;;AAAA,oDAAyD;AAIzD,MAAa,2BAA4B,SAAQ,oBAAa;IAG5D,YAAY,OAA6C;QACvD,KAAK,EAAE,CAAA;QAEP,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AARD,kEAQC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataListEntity } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateDataEntity } from './survey-template-data.entity';
|
|
3
|
+
export declare class SurveyTemplateDataListEntity extends DataListEntity {
|
|
4
|
+
items: SurveyTemplateDataEntity[];
|
|
5
|
+
constructor(partial: Partial<SurveyTemplateDataListEntity>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.SurveyTemplateDataListEntity = void 0;
|
|
13
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const survey_template_data_entity_1 = require("./survey-template-data.entity");
|
|
16
|
+
class SurveyTemplateDataListEntity extends core_1.DataListEntity {
|
|
17
|
+
constructor(partial) {
|
|
18
|
+
super(partial);
|
|
19
|
+
Object.assign(this, partial);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SurveyTemplateDataListEntity = SurveyTemplateDataListEntity;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, swagger_1.ApiProperty)({ type: survey_template_data_entity_1.SurveyTemplateDataEntity, isArray: true }),
|
|
25
|
+
__metadata("design:type", Array)
|
|
26
|
+
], SurveyTemplateDataListEntity.prototype, "items", void 0);
|
|
27
|
+
//# sourceMappingURL=survey-template-data-list.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-data-list.entity.js","sourceRoot":"","sources":["../../src/entity/survey-template-data-list.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,6CAA6C;AAE7C,+EAAwE;AAExE,MAAa,4BAA6B,SAAQ,qBAAc;IAI9D,YAAY,OAA8C;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AATD,oEASC;AAPC;IADC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,sDAAwB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2DAC9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataEntity } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateAttributes } from '../dto/survey-template-attributes.dto';
|
|
3
|
+
export declare class SurveyTemplateDataEntity extends DataEntity {
|
|
4
|
+
attributes: SurveyTemplateAttributes;
|
|
5
|
+
constructor(partial: Partial<SurveyTemplateDataEntity>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SurveyTemplateDataEntity = void 0;
|
|
4
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
5
|
+
class SurveyTemplateDataEntity extends core_1.DataEntity {
|
|
6
|
+
constructor(partial) {
|
|
7
|
+
super(partial);
|
|
8
|
+
Object.assign(this, partial);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SurveyTemplateDataEntity = SurveyTemplateDataEntity;
|
|
12
|
+
//# sourceMappingURL=survey-template-data.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-data.entity.js","sourceRoot":"","sources":["../../src/entity/survey-template-data.entity.ts"],"names":[],"mappings":";;;AAAA,oDAAsD;AAItD,MAAa,wBAAyB,SAAQ,iBAAU;IAGtD,YAAY,OAA0C;QACpD,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AARD,4DAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './survey-template-rds.handler';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./survey-template-rds.handler"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA6C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommandModel, IDataSyncHandler } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
export declare class SurveyTemplateDataSyncRdsHandler implements IDataSyncHandler {
|
|
3
|
+
private readonly prismaService;
|
|
4
|
+
private readonly logger;
|
|
5
|
+
constructor(prismaService: any);
|
|
6
|
+
up(cmd: CommandModel): Promise<any>;
|
|
7
|
+
down(cmd: CommandModel): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
var SurveyTemplateDataSyncRdsHandler_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SurveyTemplateDataSyncRdsHandler = void 0;
|
|
17
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const keys_1 = require("../keys");
|
|
20
|
+
const survey_template_module_definition_1 = require("../survey-template.module-definition");
|
|
21
|
+
let SurveyTemplateDataSyncRdsHandler = SurveyTemplateDataSyncRdsHandler_1 = class SurveyTemplateDataSyncRdsHandler {
|
|
22
|
+
constructor(prismaService) {
|
|
23
|
+
this.prismaService = prismaService;
|
|
24
|
+
this.logger = new common_1.Logger(SurveyTemplateDataSyncRdsHandler_1.name);
|
|
25
|
+
}
|
|
26
|
+
async up(cmd) {
|
|
27
|
+
this.logger.debug(cmd);
|
|
28
|
+
if (!cmd.sk.startsWith(keys_1.SURVEY_TEMPLATE_SK_PREFIX))
|
|
29
|
+
return;
|
|
30
|
+
const sk = (0, core_1.removeSortKeyVersion)(cmd.sk);
|
|
31
|
+
await this.prismaService.surveyTemplate.upsert({
|
|
32
|
+
where: {
|
|
33
|
+
id: cmd.id,
|
|
34
|
+
},
|
|
35
|
+
update: {
|
|
36
|
+
csk: cmd.sk,
|
|
37
|
+
name: cmd.name,
|
|
38
|
+
version: cmd.version,
|
|
39
|
+
seq: cmd.seq,
|
|
40
|
+
description: cmd.attributes?.description,
|
|
41
|
+
surveyTemplate: cmd.attributes?.surveyTemplate,
|
|
42
|
+
isDeleted: cmd.isDeleted || false,
|
|
43
|
+
updatedAt: cmd.updatedAt,
|
|
44
|
+
updatedBy: cmd.updatedBy,
|
|
45
|
+
updatedIp: cmd.updatedIp,
|
|
46
|
+
},
|
|
47
|
+
create: {
|
|
48
|
+
id: cmd.id,
|
|
49
|
+
cpk: cmd.pk,
|
|
50
|
+
csk: cmd.sk,
|
|
51
|
+
pk: cmd.pk,
|
|
52
|
+
sk,
|
|
53
|
+
code: sk,
|
|
54
|
+
name: cmd.name,
|
|
55
|
+
version: cmd.version,
|
|
56
|
+
tenantCode: cmd.tenantCode,
|
|
57
|
+
seq: cmd.seq,
|
|
58
|
+
description: cmd.attributes?.description,
|
|
59
|
+
surveyTemplate: cmd.attributes?.surveyTemplate,
|
|
60
|
+
createdAt: cmd.createdAt,
|
|
61
|
+
createdBy: cmd.createdBy,
|
|
62
|
+
createdIp: cmd.createdIp,
|
|
63
|
+
updatedAt: cmd.updatedAt,
|
|
64
|
+
updatedBy: cmd.updatedBy,
|
|
65
|
+
updatedIp: cmd.updatedIp,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async down(cmd) {
|
|
70
|
+
this.logger.debug(cmd);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.SurveyTemplateDataSyncRdsHandler = SurveyTemplateDataSyncRdsHandler;
|
|
74
|
+
exports.SurveyTemplateDataSyncRdsHandler = SurveyTemplateDataSyncRdsHandler = SurveyTemplateDataSyncRdsHandler_1 = __decorate([
|
|
75
|
+
(0, common_1.Injectable)(),
|
|
76
|
+
__param(0, (0, common_1.Inject)(survey_template_module_definition_1.PRISMA_SERVICE)),
|
|
77
|
+
__metadata("design:paramtypes", [Object])
|
|
78
|
+
], SurveyTemplateDataSyncRdsHandler);
|
|
79
|
+
//# sourceMappingURL=survey-template-rds.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template-rds.handler.js","sourceRoot":"","sources":["../../src/handler/survey-template-rds.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA2D;AAE3D,kCAAmD;AACnD,4FAAqE;AAG9D,IAAM,gCAAgC,wCAAtC,MAAM,gCAAgC;IAG3C,YAEE,aAAmC;QAAlB,kBAAa,GAAb,aAAa,CAAK;QAJpB,WAAM,GAAG,IAAI,eAAM,CAAC,kCAAgC,CAAC,IAAI,CAAC,CAAA;IAKxE,CAAC;IAEJ,KAAK,CAAC,EAAE,CAAC,GAAiB;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,gCAAyB,CAAC;YAAE,OAAM;QACzD,MAAM,EAAE,GAAG,IAAA,2BAAoB,EAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACvC,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC;YAC7C,KAAK,EAAE;gBACL,EAAE,EAAE,GAAG,CAAC,EAAE;aACX;YACD,MAAM,EAAE;gBACN,GAAG,EAAE,GAAG,CAAC,EAAE;gBACX,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW;gBACxC,cAAc,EAAE,GAAG,CAAC,UAAU,EAAE,cAAc;gBAC9C,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,KAAK;gBACjC,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;aACzB;YACD,MAAM,EAAE;gBACN,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,GAAG,EAAE,GAAG,CAAC,EAAE;gBACX,GAAG,EAAE,GAAG,CAAC,EAAE;gBACX,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,WAAW,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW;gBACxC,cAAc,EAAE,GAAG,CAAC,UAAU,EAAE,cAAc;gBAC9C,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,SAAS;aACzB;SACF,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAiB;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;CACF,CAAA;AArDY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,kDAAc,CAAC,CAAA;;GAJd,gCAAgC,CAqD5C"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './dto';
|
|
2
|
+
export * from './entity';
|
|
3
|
+
export * from './handler';
|
|
4
|
+
export * from './keys';
|
|
5
|
+
export * from './survey-template.controller';
|
|
6
|
+
export * from './survey-template.module';
|
|
7
|
+
export * from './survey-template.module-definition';
|
|
8
|
+
export * from './survey-template.service';
|
|
9
|
+
export * from './utils';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dto"), exports);
|
|
18
|
+
__exportStar(require("./entity"), exports);
|
|
19
|
+
__exportStar(require("./handler"), exports);
|
|
20
|
+
__exportStar(require("./keys"), exports);
|
|
21
|
+
__exportStar(require("./survey-template.controller"), exports);
|
|
22
|
+
__exportStar(require("./survey-template.module"), exports);
|
|
23
|
+
__exportStar(require("./survey-template.module-definition"), exports);
|
|
24
|
+
__exportStar(require("./survey-template.service"), exports);
|
|
25
|
+
__exportStar(require("./utils"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AACtB,+DAA4C;AAC5C,2DAAwC;AACxC,sEAAmD;AACnD,4DAAyC;AACzC,0CAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SURVEY_TEMPLATE_SK_PREFIX = "TEMPLATE";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keys/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DetailDto, IInvoke, SearchDto } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateCreateDto } from './dto/survey-template-create.dto';
|
|
3
|
+
import { SurveyTemplateUpdateDto } from './dto/survey-template-update.dto';
|
|
4
|
+
import { SurveyTemplateDataEntity } from './entity/survey-template-data.entity';
|
|
5
|
+
import { SurveyTemplateService } from './survey-template.service';
|
|
6
|
+
export declare class SurveyTemplateController {
|
|
7
|
+
private readonly surveyTemplateService;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
constructor(surveyTemplateService: SurveyTemplateService);
|
|
10
|
+
searchData(searchDto: SearchDto, invokeContext: IInvoke): Promise<import("./entity").SurveyTemplateDataListEntity>;
|
|
11
|
+
create(invokeContext: IInvoke, createDto: SurveyTemplateCreateDto): Promise<SurveyTemplateDataEntity>;
|
|
12
|
+
getData(detailDto: DetailDto): Promise<SurveyTemplateDataEntity>;
|
|
13
|
+
updateData(detailDto: DetailDto, updateDto: SurveyTemplateUpdateDto, invokeContext: IInvoke): Promise<SurveyTemplateDataEntity>;
|
|
14
|
+
deleteData(detailDto: DetailDto, invokeContext: IInvoke): Promise<SurveyTemplateDataEntity>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
var SurveyTemplateController_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SurveyTemplateController = void 0;
|
|
17
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
18
|
+
const master_1 = require("@mbc-cqrs-serverless/master");
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
+
const survey_template_create_dto_1 = require("./dto/survey-template-create.dto");
|
|
22
|
+
const survey_template_update_dto_1 = require("./dto/survey-template-update.dto");
|
|
23
|
+
const survey_template_service_1 = require("./survey-template.service");
|
|
24
|
+
let SurveyTemplateController = SurveyTemplateController_1 = class SurveyTemplateController {
|
|
25
|
+
constructor(surveyTemplateService) {
|
|
26
|
+
this.surveyTemplateService = surveyTemplateService;
|
|
27
|
+
this.logger = new common_1.Logger(SurveyTemplateController_1.name);
|
|
28
|
+
}
|
|
29
|
+
async searchData(searchDto, invokeContext) {
|
|
30
|
+
const { tenantCode } = (0, core_1.getUserContext)(invokeContext);
|
|
31
|
+
return await this.surveyTemplateService.searchData(tenantCode, searchDto);
|
|
32
|
+
}
|
|
33
|
+
async create(invokeContext, createDto) {
|
|
34
|
+
this.logger.debug('createDto:', createDto);
|
|
35
|
+
return await this.surveyTemplateService.create(createDto, { invokeContext });
|
|
36
|
+
}
|
|
37
|
+
async getData(detailDto) {
|
|
38
|
+
return await this.surveyTemplateService.findOne(detailDto);
|
|
39
|
+
}
|
|
40
|
+
async updateData(detailDto, updateDto, invokeContext) {
|
|
41
|
+
this.logger.debug('updateDto:', updateDto);
|
|
42
|
+
return await this.surveyTemplateService.update(detailDto, updateDto, {
|
|
43
|
+
invokeContext,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async deleteData(detailDto, invokeContext) {
|
|
47
|
+
return await this.surveyTemplateService.remove(detailDto, { invokeContext });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.SurveyTemplateController = SurveyTemplateController;
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, common_1.Get)('/'),
|
|
53
|
+
__param(0, (0, common_1.Query)()),
|
|
54
|
+
__param(1, (0, core_1.INVOKE_CONTEXT)()),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [core_1.SearchDto, Object]),
|
|
57
|
+
__metadata("design:returntype", Promise)
|
|
58
|
+
], SurveyTemplateController.prototype, "searchData", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, common_1.Post)('/'),
|
|
61
|
+
__param(0, (0, core_1.INVOKE_CONTEXT)()),
|
|
62
|
+
__param(1, (0, common_1.Body)()),
|
|
63
|
+
__metadata("design:type", Function),
|
|
64
|
+
__metadata("design:paramtypes", [Object, survey_template_create_dto_1.SurveyTemplateCreateDto]),
|
|
65
|
+
__metadata("design:returntype", Promise)
|
|
66
|
+
], SurveyTemplateController.prototype, "create", null);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, common_1.Get)('/:id'),
|
|
69
|
+
__param(0, (0, master_1.DetailKeys)()),
|
|
70
|
+
__metadata("design:type", Function),
|
|
71
|
+
__metadata("design:paramtypes", [core_1.DetailDto]),
|
|
72
|
+
__metadata("design:returntype", Promise)
|
|
73
|
+
], SurveyTemplateController.prototype, "getData", null);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, common_1.Put)('/:id'),
|
|
76
|
+
__param(0, (0, master_1.DetailKeys)()),
|
|
77
|
+
__param(1, (0, common_1.Body)()),
|
|
78
|
+
__param(2, (0, core_1.INVOKE_CONTEXT)()),
|
|
79
|
+
__metadata("design:type", Function),
|
|
80
|
+
__metadata("design:paramtypes", [core_1.DetailDto,
|
|
81
|
+
survey_template_update_dto_1.SurveyTemplateUpdateDto, Object]),
|
|
82
|
+
__metadata("design:returntype", Promise)
|
|
83
|
+
], SurveyTemplateController.prototype, "updateData", null);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, common_1.Delete)('/:id'),
|
|
86
|
+
__param(0, (0, master_1.DetailKeys)()),
|
|
87
|
+
__param(1, (0, core_1.INVOKE_CONTEXT)()),
|
|
88
|
+
__metadata("design:type", Function),
|
|
89
|
+
__metadata("design:paramtypes", [core_1.DetailDto, Object]),
|
|
90
|
+
__metadata("design:returntype", Promise)
|
|
91
|
+
], SurveyTemplateController.prototype, "deleteData", null);
|
|
92
|
+
exports.SurveyTemplateController = SurveyTemplateController = SurveyTemplateController_1 = __decorate([
|
|
93
|
+
(0, common_1.Controller)('api/survey-template'),
|
|
94
|
+
(0, swagger_1.ApiTags)('survey-template'),
|
|
95
|
+
__metadata("design:paramtypes", [survey_template_service_1.SurveyTemplateService])
|
|
96
|
+
], SurveyTemplateController);
|
|
97
|
+
//# sourceMappingURL=survey-template.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template.controller.js","sourceRoot":"","sources":["../src/survey-template.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAMkC;AAClC,wDAAwD;AACxD,2CASuB;AACvB,6CAAyC;AAEzC,iFAA0E;AAC1E,iFAA0E;AAE1E,uEAAiE;AAI1D,IAAM,wBAAwB,gCAA9B,MAAM,wBAAw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,GAAG,CAAC;IAEN,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,qBAAc,GAAE,CAAA;;qCADG,gBAAS;;0DAK9B;AAGK;IADL,IAAA,aAAI,EAAC,GAAG,CAAC;IAEP,WAAA,IAAA,qBAAc,GAAE,CAAA;IAChB,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAY,oDAAuB;;sDAK3C;AAGK;IADL,IAAA,YAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,mBAAU,GAAE,CAAA;;qCAAY,gBAAS;;uDAGnC;AAGK;IADL,IAAA,YAAG,EAAC,MAAM,CAAC;IAET,WAAA,IAAA,mBAAU,GAAE,CAAA;IACZ,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,qBAAc,GAAE,CAAA;;qCAFQ,gBAAS;QACf,oDAAuB;;0DAO3C;AAGK;IADL,IAAA,eAAM,EAAC,MAAM,CAAC;IAEZ,WAAA,IAAA,mBAAU,GAAE,CAAA;IACZ,WAAA,IAAA,qBAAc,GAAE,CAAA;;qCADQ,gBAAS;;0DAInC;mCAjDU,wBAAwB;IAFpC,IAAA,mBAAU,EAAC,qBAAqB,CAAC;IACjC,IAAA,iBAAO,EAAC,iBAAiB,CAAC;qCAI2B,+CAAqB;GAH9D,wBAAwB,CAkDpC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDataSyncHandler } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { Type } from '@nestjs/common';
|
|
3
|
+
export declare const PRISMA_SERVICE = "PrismaServiceInjectToken";
|
|
4
|
+
export interface SurveyTemplateModuleOptions {
|
|
5
|
+
enableController?: boolean;
|
|
6
|
+
dataSyncHandlers?: Type<IDataSyncHandler>[];
|
|
7
|
+
prismaService?: Type<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<SurveyTemplateModuleOptions, "register", "create", {}>, MODULE_OPTIONS_TOKEN: string | symbol, OPTIONS_TYPE: SurveyTemplateModuleOptions & Partial<{}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.PRISMA_SERVICE = void 0;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
exports.PRISMA_SERVICE = 'PrismaServiceInjectToken';
|
|
7
|
+
_a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE;
|
|
8
|
+
//# sourceMappingURL=survey-template.module-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template.module-definition.js","sourceRoot":"","sources":["../src/survey-template.module-definition.ts"],"names":[],"mappings":";;;;AACA,2CAA0D;AAG7C,QAAA,cAAc,GAAG,0BAA0B,CAAA;AAQ3C,KACX,IAAI,kCAAyB,EAA+B,CAAC,KAAK,EAAE,EADvD,+BAAuB,+BAAE,4BAAoB,4BAAE,oBAAY,mBACJ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { ConfigurableModuleClass, OPTIONS_TYPE } from './survey-template.module-definition';
|
|
3
|
+
export declare class SurveyTemplateModule extends ConfigurableModuleClass {
|
|
4
|
+
static register(options: typeof OPTIONS_TYPE): DynamicModule;
|
|
5
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { CommandModule } from '@mbc-cqrs-serverless/core'
|
|
3
|
+
// import { Module } from '@nestjs/common'
|
|
4
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
5
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7
|
+
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;
|
|
8
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.SurveyTemplateModule = void 0;
|
|
12
|
+
// import { SurveyTemplateDataSyncRdsHandler } from './handler/survey-template-rds.handler'
|
|
13
|
+
// import { SurveyTemplateController } from './survey-template.controller'
|
|
14
|
+
// import { SurveyTemplateService } from './survey-template.service'
|
|
15
|
+
// @Module({
|
|
16
|
+
// imports: [
|
|
17
|
+
// CommandModule.register({
|
|
18
|
+
// tableName: 'survey',
|
|
19
|
+
// dataSyncHandlers: [SurveyTemplateDataSyncRdsHandler],
|
|
20
|
+
// }),
|
|
21
|
+
// ],
|
|
22
|
+
// controllers: [SurveyTemplateController],
|
|
23
|
+
// providers: [SurveyTemplateService],
|
|
24
|
+
// exports: [SurveyTemplateService],
|
|
25
|
+
// })
|
|
26
|
+
// export class SurveyTemplateModule {}
|
|
27
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
28
|
+
const common_1 = require("@nestjs/common");
|
|
29
|
+
const survey_template_rds_handler_1 = require("./handler/survey-template-rds.handler");
|
|
30
|
+
const survey_template_controller_1 = require("./survey-template.controller");
|
|
31
|
+
const survey_template_module_definition_1 = require("./survey-template.module-definition");
|
|
32
|
+
const survey_template_service_1 = require("./survey-template.service");
|
|
33
|
+
let SurveyTemplateModule = class SurveyTemplateModule extends survey_template_module_definition_1.ConfigurableModuleClass {
|
|
34
|
+
static register(options) {
|
|
35
|
+
const module = super.register(options);
|
|
36
|
+
if (options.enableController) {
|
|
37
|
+
if (!options.prismaService) {
|
|
38
|
+
throw new Error('PrismaService must be provided when enableController is true.');
|
|
39
|
+
}
|
|
40
|
+
if (!module.controllers) {
|
|
41
|
+
module.controllers = [];
|
|
42
|
+
}
|
|
43
|
+
module.controllers.push(survey_template_controller_1.SurveyTemplateController);
|
|
44
|
+
if (!module.providers) {
|
|
45
|
+
module.providers = [];
|
|
46
|
+
}
|
|
47
|
+
module.providers.push({
|
|
48
|
+
provide: survey_template_module_definition_1.PRISMA_SERVICE,
|
|
49
|
+
useExisting: options.prismaService,
|
|
50
|
+
});
|
|
51
|
+
module.providers.push(survey_template_rds_handler_1.SurveyTemplateDataSyncRdsHandler);
|
|
52
|
+
if (!module.imports) {
|
|
53
|
+
module.imports = [];
|
|
54
|
+
}
|
|
55
|
+
const imports = [...(module.imports ?? [])];
|
|
56
|
+
imports.push(core_1.CommandModule.register({
|
|
57
|
+
tableName: 'survey',
|
|
58
|
+
dataSyncHandlers: options?.dataSyncHandlers,
|
|
59
|
+
}));
|
|
60
|
+
return {
|
|
61
|
+
...module,
|
|
62
|
+
imports,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.SurveyTemplateModule = SurveyTemplateModule;
|
|
68
|
+
exports.SurveyTemplateModule = SurveyTemplateModule = __decorate([
|
|
69
|
+
(0, common_1.Module)({
|
|
70
|
+
imports: [core_1.DataStoreModule, core_1.QueueModule],
|
|
71
|
+
providers: [survey_template_service_1.SurveyTemplateService],
|
|
72
|
+
exports: [survey_template_service_1.SurveyTemplateService],
|
|
73
|
+
})
|
|
74
|
+
], SurveyTemplateModule);
|
|
75
|
+
//# sourceMappingURL=survey-template.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template.module.js","sourceRoot":"","sources":["../src/survey-template.module.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,0CAA0C;;;;;;;;;AAE1C,2FAA2F;AAC3F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AC,CAAC,CAAA;YAC3C,OAAO,CAAC,IAAI,CACV,oBAAa,CAAC,QAAQ,CAAC;gBACrB,SAAS,EAAE,QAAQ;gBACnB,gBAAgB,EAAE,OAAO,EAAE,gBAAgB;aAC5C,CAAC,CACH,CAAA;YACD,OAAO;gBACL,GAAG,MAAM;gBACT,OAAO;aACR,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAxCY,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAe,EAAE,kBAAW,CAAC;QACvC,SAAS,EAAE,CAAC,+CAAqB,CAAC;QAClC,OAAO,EAAE,CAAC,+CAAqB,CAAC;KACjC,CAAC;GACW,oBAAoB,CAwChC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CommandService, DataService, DetailDto, IInvoke, SearchDto } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
import { SurveyTemplateCreateDto } from './dto/survey-template-create.dto';
|
|
3
|
+
import { SurveyTemplateUpdateDto } from './dto/survey-template-update.dto';
|
|
4
|
+
import { SurveyTemplateDataEntity } from './entity/survey-template-data.entity';
|
|
5
|
+
import { SurveyTemplateDataListEntity } from './entity/survey-template-data-list.entity';
|
|
6
|
+
export declare class SurveyTemplateService {
|
|
7
|
+
private readonly prismaService;
|
|
8
|
+
private readonly commandService;
|
|
9
|
+
private readonly dataService;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
constructor(prismaService: any, commandService: CommandService, dataService: DataService);
|
|
12
|
+
searchData(tenantCode: string, searchDto: SearchDto): Promise<SurveyTemplateDataListEntity>;
|
|
13
|
+
create(createDto: SurveyTemplateCreateDto, options: {
|
|
14
|
+
invokeContext: IInvoke;
|
|
15
|
+
}): Promise<SurveyTemplateDataEntity>;
|
|
16
|
+
findOne(detailDto: DetailDto): Promise<SurveyTemplateDataEntity>;
|
|
17
|
+
update(detailDto: DetailDto, updateDto: SurveyTemplateUpdateDto, options: {
|
|
18
|
+
invokeContext: IInvoke;
|
|
19
|
+
}): Promise<SurveyTemplateDataEntity>;
|
|
20
|
+
remove(detailDto: DetailDto, options: {
|
|
21
|
+
invokeContext: IInvoke;
|
|
22
|
+
}): Promise<SurveyTemplateDataEntity>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
var SurveyTemplateService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SurveyTemplateService = void 0;
|
|
17
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const ulid_1 = require("ulid");
|
|
21
|
+
const survey_template_command_dto_1 = require("./dto/survey-template-command.dto");
|
|
22
|
+
const survey_template_data_entity_1 = require("./entity/survey-template-data.entity");
|
|
23
|
+
const survey_template_data_list_entity_1 = require("./entity/survey-template-data-list.entity");
|
|
24
|
+
const keys_1 = require("./keys");
|
|
25
|
+
const survey_template_module_definition_1 = require("./survey-template.module-definition");
|
|
26
|
+
const utils_1 = require("./utils");
|
|
27
|
+
let SurveyTemplateService = SurveyTemplateService_1 = class SurveyTemplateService {
|
|
28
|
+
constructor(prismaService, commandService, dataService) {
|
|
29
|
+
this.prismaService = prismaService;
|
|
30
|
+
this.commandService = commandService;
|
|
31
|
+
this.dataService = dataService;
|
|
32
|
+
this.logger = new common_1.Logger(SurveyTemplateService_1.name);
|
|
33
|
+
}
|
|
34
|
+
async searchData(tenantCode, searchDto) {
|
|
35
|
+
const where = {
|
|
36
|
+
isDeleted: false,
|
|
37
|
+
tenantCode,
|
|
38
|
+
};
|
|
39
|
+
if (searchDto.keyword?.trim()) {
|
|
40
|
+
where.OR = [
|
|
41
|
+
{ name: { contains: searchDto.keyword.trim(), mode: 'insensitive' } },
|
|
42
|
+
{
|
|
43
|
+
description: {
|
|
44
|
+
contains: searchDto.keyword.trim(),
|
|
45
|
+
mode: 'insensitive',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
if (searchDto.id) {
|
|
51
|
+
where.id = searchDto.id;
|
|
52
|
+
}
|
|
53
|
+
if (searchDto.pk) {
|
|
54
|
+
where.pk = searchDto.pk;
|
|
55
|
+
}
|
|
56
|
+
if (searchDto.sk) {
|
|
57
|
+
where.sk = searchDto.sk;
|
|
58
|
+
}
|
|
59
|
+
const { pageSize = 10, page = 1, orderBys = ['-createdAt'] } = searchDto;
|
|
60
|
+
const [total, items] = await Promise.all([
|
|
61
|
+
this.prismaService.surveyTemplate.count({ where }),
|
|
62
|
+
this.prismaService.surveyTemplate.findMany({
|
|
63
|
+
where,
|
|
64
|
+
take: pageSize,
|
|
65
|
+
skip: pageSize * (page - 1),
|
|
66
|
+
orderBy: (0, utils_1.getOrderBys)(orderBys),
|
|
67
|
+
}),
|
|
68
|
+
]);
|
|
69
|
+
return new survey_template_data_list_entity_1.SurveyTemplateDataListEntity({
|
|
70
|
+
total,
|
|
71
|
+
items: items.map((item) => new survey_template_data_entity_1.SurveyTemplateDataEntity({
|
|
72
|
+
...item,
|
|
73
|
+
attributes: {
|
|
74
|
+
surveyTemplate: item.surveyTemplate,
|
|
75
|
+
description: item.description,
|
|
76
|
+
},
|
|
77
|
+
})),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async create(createDto, options) {
|
|
81
|
+
const { tenantCode } = (0, core_1.getUserContext)(options.invokeContext);
|
|
82
|
+
const pk = `SURVEY${core_1.KEY_SEPARATOR}${tenantCode}`;
|
|
83
|
+
const sk = `${keys_1.SURVEY_TEMPLATE_SK_PREFIX}${core_1.KEY_SEPARATOR}${(0, ulid_1.ulid)()}`;
|
|
84
|
+
const commandDto = {
|
|
85
|
+
pk,
|
|
86
|
+
sk,
|
|
87
|
+
id: (0, core_1.generateId)(pk, sk),
|
|
88
|
+
tenantCode,
|
|
89
|
+
code: sk,
|
|
90
|
+
type: keys_1.SURVEY_TEMPLATE_SK_PREFIX,
|
|
91
|
+
version: core_1.VERSION_FIRST,
|
|
92
|
+
name: createDto.name,
|
|
93
|
+
attributes: createDto.attributes,
|
|
94
|
+
};
|
|
95
|
+
this.logger.debug('commandService:' + this.commandService.tableName);
|
|
96
|
+
const item = await this.commandService.publishAsync(commandDto, {
|
|
97
|
+
invokeContext: options.invokeContext,
|
|
98
|
+
source: (0, core_1.getCommandSource)((0, path_1.basename)(__dirname), this.constructor.name, 'create'),
|
|
99
|
+
});
|
|
100
|
+
return new survey_template_data_entity_1.SurveyTemplateDataEntity(item);
|
|
101
|
+
}
|
|
102
|
+
async findOne(detailDto) {
|
|
103
|
+
const item = await this.dataService.getItem(detailDto);
|
|
104
|
+
if (!item) {
|
|
105
|
+
throw new common_1.NotFoundException('Survey template not found!');
|
|
106
|
+
}
|
|
107
|
+
return new survey_template_data_entity_1.SurveyTemplateDataEntity(item);
|
|
108
|
+
}
|
|
109
|
+
async update(detailDto, updateDto, options) {
|
|
110
|
+
const userContext = (0, core_1.getUserContext)(options.invokeContext);
|
|
111
|
+
const { tenantCode } = (0, utils_1.parsePk)(detailDto.pk);
|
|
112
|
+
if (userContext.tenantCode !== tenantCode) {
|
|
113
|
+
throw new common_1.BadRequestException('Invalid tenant code');
|
|
114
|
+
}
|
|
115
|
+
const data = (await this.dataService.getItem(detailDto));
|
|
116
|
+
if (!data) {
|
|
117
|
+
throw new common_1.NotFoundException('Survey template not found!');
|
|
118
|
+
}
|
|
119
|
+
const commandDto = new survey_template_command_dto_1.SurveyTemplateCommandDto({
|
|
120
|
+
pk: data.pk,
|
|
121
|
+
sk: data.sk,
|
|
122
|
+
version: data.version,
|
|
123
|
+
name: updateDto.name ?? data.name,
|
|
124
|
+
isDeleted: updateDto.isDeleted ?? data.isDeleted,
|
|
125
|
+
attributes: {
|
|
126
|
+
...data.attributes,
|
|
127
|
+
...updateDto.attributes,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
const item = await this.commandService.publishPartialUpdateAsync(commandDto, {
|
|
131
|
+
invokeContext: options.invokeContext,
|
|
132
|
+
source: (0, core_1.getCommandSource)((0, path_1.basename)(__dirname), this.constructor.name, 'update'),
|
|
133
|
+
});
|
|
134
|
+
return new survey_template_data_entity_1.SurveyTemplateDataEntity(item);
|
|
135
|
+
}
|
|
136
|
+
async remove(detailDto, options) {
|
|
137
|
+
const userContext = (0, core_1.getUserContext)(options.invokeContext);
|
|
138
|
+
const { tenantCode } = (0, utils_1.parsePk)(detailDto.pk);
|
|
139
|
+
if (userContext.tenantCode !== tenantCode) {
|
|
140
|
+
throw new common_1.BadRequestException('Invalid tenant code');
|
|
141
|
+
}
|
|
142
|
+
const data = (await this.dataService.getItem(detailDto));
|
|
143
|
+
if (!data) {
|
|
144
|
+
throw new common_1.NotFoundException('Survey template not found!');
|
|
145
|
+
}
|
|
146
|
+
const commandDto = new survey_template_command_dto_1.SurveyTemplateCommandDto({
|
|
147
|
+
pk: data.pk,
|
|
148
|
+
sk: data.sk,
|
|
149
|
+
version: data.version,
|
|
150
|
+
isDeleted: true,
|
|
151
|
+
});
|
|
152
|
+
const item = await this.commandService.publishPartialUpdateAsync(commandDto, {
|
|
153
|
+
invokeContext: options.invokeContext,
|
|
154
|
+
source: (0, core_1.getCommandSource)((0, path_1.basename)(__dirname), this.constructor.name, 'remove'),
|
|
155
|
+
});
|
|
156
|
+
return new survey_template_data_entity_1.SurveyTemplateDataEntity(item);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
exports.SurveyTemplateService = SurveyTemplateService;
|
|
160
|
+
exports.SurveyTemplateService = SurveyTemplateService = SurveyTemplateService_1 = __decorate([
|
|
161
|
+
(0, common_1.Injectable)(),
|
|
162
|
+
__param(0, (0, common_1.Inject)(survey_template_module_definition_1.PRISMA_SERVICE)),
|
|
163
|
+
__metadata("design:paramtypes", [Object, core_1.CommandService,
|
|
164
|
+
core_1.DataService])
|
|
165
|
+
], SurveyTemplateService);
|
|
166
|
+
//# sourceMappingURL=survey-template.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-template.service.js","sourceRoot":"","sources":["../src/survey-template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAWkC;AAClC,2CAMuB;AACvB,+BAA+B;AAC/B,+BAA2B;AAE3B,mFAA4E;AAG5E,sFAA+E;AAC/E,gGAAwF;AACxF,iCAAkD;AAClD,2FAAoE;AACpE,mCAA8C;AAGvC,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YAEE,aAAmC,EAClB,cAA8B,EAC9B,WAAwB;QAFxB,kBAAa,GAAb,aAAa,CAAK;QAClB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAW,GAAX,WAAW,CAAa;QAN1B,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAA;IAO7D,CAAC;IAEJ,KAAK,CAAC,UAAU,CACd,UAAkB,EAClB,SAAoB;QAEpB,MAAM,KAAK,GAAQ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AAC,EACnB,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,QAAQ,CACT;SACF,CACF,CAAA;QACD,OAAO,IAAI,sDAAwB,CAAC,IAAgC,CAAC,CAAA;IACvE,CAAC;CACF,CAAA;AAnLY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,kDAAc,CAAC,CAAA;6CAEU,qBAAc;QACjB,kBAAW;GAPhC,qBAAqB,CAmLjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum SortOrder {
|
|
2
|
+
asc = "asc",
|
|
3
|
+
desc = "desc"
|
|
4
|
+
}
|
|
5
|
+
declare function parsePk(pk: string): {
|
|
6
|
+
type: string;
|
|
7
|
+
tenantCode: string;
|
|
8
|
+
};
|
|
9
|
+
declare function getOrderBy(order: string): {
|
|
10
|
+
[x: string]: SortOrder;
|
|
11
|
+
};
|
|
12
|
+
declare function getOrderBys<T>(orders: string[]): T[];
|
|
13
|
+
export { getOrderBy, getOrderBys, parsePk };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SortOrder = void 0;
|
|
4
|
+
exports.getOrderBy = getOrderBy;
|
|
5
|
+
exports.getOrderBys = getOrderBys;
|
|
6
|
+
exports.parsePk = parsePk;
|
|
7
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
8
|
+
var SortOrder;
|
|
9
|
+
(function (SortOrder) {
|
|
10
|
+
SortOrder["asc"] = "asc";
|
|
11
|
+
SortOrder["desc"] = "desc";
|
|
12
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
13
|
+
function parsePk(pk) {
|
|
14
|
+
if (pk.split(core_1.KEY_SEPARATOR).length !== 2) {
|
|
15
|
+
throw new Error('Invalid PK');
|
|
16
|
+
}
|
|
17
|
+
const [type, tenantCode] = pk.split(core_1.KEY_SEPARATOR);
|
|
18
|
+
return {
|
|
19
|
+
type,
|
|
20
|
+
tenantCode,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function getOrderBy(order) {
|
|
24
|
+
let orderValue = SortOrder.asc, orderKey = order;
|
|
25
|
+
if (order.startsWith('-')) {
|
|
26
|
+
orderValue = SortOrder.desc;
|
|
27
|
+
orderKey = order.slice(1);
|
|
28
|
+
}
|
|
29
|
+
return { [orderKey]: orderValue };
|
|
30
|
+
}
|
|
31
|
+
function getOrderBys(orders) {
|
|
32
|
+
if (!orders) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return orders.map((order) => getOrderBy(order));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAoCS,gCAAU;AAAE,kCAAW;AAAE,0BAAO;AApCzC,oDAAyD;AAEzD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,SAAS,OAAO,CAAC,EAAU;IACzB,IAAI,EAAE,CAAC,KAAK,CAAC,oBAAa,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC;IACD,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,oBAAa,CAAC,CAAA;IAClD,OAAO;QACL,IAAI;QACJ,UAAU;KACX,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,UAAU,GAAc,SAAS,CAAC,GAAG,EACvC,QAAQ,GAAG,KAAK,CAAA;IAClB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,UAAU,GAAG,SAAS,CAAC,IAAI,CAAA;QAC3B,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC;IAED,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAA;AACnC,CAAC;AAED,SAAS,WAAW,CAAI,MAAgB;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAQ,CAAA;AACxD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mbc-cqrs-serverless/survey-template",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Survey module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mbc",
|
|
7
|
+
"cqrs",
|
|
8
|
+
"serverless",
|
|
9
|
+
"framework",
|
|
10
|
+
"event-driven",
|
|
11
|
+
"backend",
|
|
12
|
+
"aws",
|
|
13
|
+
"lambda",
|
|
14
|
+
"ecs",
|
|
15
|
+
"fargate",
|
|
16
|
+
"step-functions",
|
|
17
|
+
"sqs",
|
|
18
|
+
"typescript"
|
|
19
|
+
],
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"!dist/tsconfig.tsbuildinfo"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rm -rf dist && tsc",
|
|
28
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/mbc-net/mbc-cqrs-serverless.git"
|
|
33
|
+
},
|
|
34
|
+
"author": "Murakami Business Consulting, Inc.",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/mbc-net/mbc-cqrs-serverless/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://mbc-cqrs-serverless.mbc-net.com/",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@mbc-cqrs-serverless/core": "1.0.2",
|
|
45
|
+
"@mbc-cqrs-serverless/master": "1.0.2"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "41293a759a1dfe3340ebffcc15114ca83f10827a"
|
|
48
|
+
}
|