@dssp/project 0.0.9 → 0.0.11
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/client/pages/project/project-detail.ts +109 -30
- package/client/pages/project/project-list.ts +46 -10
- package/client/pages/project/project-schedule-list.ts +11 -3
- package/client/pages/project/project-schedule.ts +86 -339
- package/client/pages/project/project-setting-list.ts +11 -3
- package/client/pages/resource/construction-detail-type-popup.ts +201 -0
- package/client/pages/resource/construction-type-management.ts +40 -39
- package/client/pages/resource/inspection-drawing-type-management.ts +210 -0
- package/client/pages/resource/inspection-part-popup.ts +201 -0
- package/client/pages/resource/manager-management.ts +0 -27
- package/client/pages/{checklist/checklist-importer.ts → resource/resource-importer.ts} +11 -8
- package/client/pages/{checklist/checklist-list-page.ts → resource/resource-list-page.ts} +41 -25
- package/client/pages/resource/worker-type-management.ts +3 -37
- package/client/pages/task-resource/task-resource-importer.ts +97 -0
- package/client/pages/task-resource/task-resource-list-page.ts +356 -0
- package/client/route.ts +13 -1
- package/dist-client/pages/project/project-detail.d.ts +5 -1
- package/dist-client/pages/project/project-detail.js +123 -40
- package/dist-client/pages/project/project-detail.js.map +1 -1
- package/dist-client/pages/project/project-list.d.ts +33 -7
- package/dist-client/pages/project/project-list.js +26 -11
- package/dist-client/pages/project/project-list.js.map +1 -1
- package/dist-client/pages/project/project-schedule-list.js +11 -3
- package/dist-client/pages/project/project-schedule-list.js.map +1 -1
- package/dist-client/pages/project/project-schedule.d.ts +5 -1
- package/dist-client/pages/project/project-schedule.js +96 -337
- package/dist-client/pages/project/project-schedule.js.map +1 -1
- package/dist-client/pages/project/project-setting-list.js +11 -3
- package/dist-client/pages/project/project-setting-list.js.map +1 -1
- package/dist-client/pages/resource/construction-detail-type-popup.d.ts +2 -0
- package/dist-client/pages/resource/construction-detail-type-popup.js +197 -0
- package/dist-client/pages/resource/construction-detail-type-popup.js.map +1 -0
- package/dist-client/pages/resource/construction-type-management.d.ts +12 -0
- package/dist-client/pages/resource/construction-type-management.js +30 -38
- package/dist-client/pages/resource/construction-type-management.js.map +1 -1
- package/dist-client/pages/resource/inspection-drawing-type-management.d.ts +34 -0
- package/dist-client/pages/resource/inspection-drawing-type-management.js +198 -0
- package/dist-client/pages/resource/inspection-drawing-type-management.js.map +1 -0
- package/dist-client/pages/resource/inspection-part-popup.d.ts +2 -0
- package/dist-client/pages/resource/inspection-part-popup.js +197 -0
- package/dist-client/pages/resource/inspection-part-popup.js.map +1 -0
- package/dist-client/pages/resource/manager-management.js +0 -27
- package/dist-client/pages/resource/manager-management.js.map +1 -1
- package/dist-client/pages/{checklist/checklist-importer.d.ts → resource/resource-importer.d.ts} +2 -2
- package/dist-client/pages/{checklist/checklist-importer.js → resource/resource-importer.js} +10 -10
- package/dist-client/pages/resource/resource-importer.js.map +1 -0
- package/dist-client/pages/{checklist/checklist-list-page.d.ts → resource/resource-list-page.d.ts} +6 -6
- package/dist-client/pages/{checklist/checklist-list-page.js → resource/resource-list-page.js} +41 -32
- package/dist-client/pages/resource/resource-list-page.js.map +1 -0
- package/dist-client/pages/resource/worker-type-management.d.ts +7 -1
- package/dist-client/pages/resource/worker-type-management.js +3 -45
- package/dist-client/pages/resource/worker-type-management.js.map +1 -1
- package/dist-client/pages/task-resource/task-resource-importer.d.ts +10 -0
- package/dist-client/pages/task-resource/task-resource-importer.js +101 -0
- package/dist-client/pages/task-resource/task-resource-importer.js.map +1 -0
- package/dist-client/pages/task-resource/task-resource-list-page.d.ts +63 -0
- package/dist-client/pages/task-resource/task-resource-list-page.js +332 -0
- package/dist-client/pages/task-resource/task-resource-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +9 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/import-task.d.ts +19 -0
- package/dist-server/controllers/import-task.js +104 -0
- package/dist-server/controllers/import-task.js.map +1 -0
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1723861466413-seed-roles.d.ts +5 -0
- package/dist-server/migrations/1723861466413-seed-roles.js +117 -0
- package/dist-server/migrations/1723861466413-seed-roles.js.map +1 -0
- package/dist-server/migrations/1723861466414-seed-codes.d.ts +5 -0
- package/dist-server/migrations/1723861466414-seed-codes.js +132 -0
- package/dist-server/migrations/1723861466414-seed-codes.js.map +1 -0
- package/dist-server/migrations/1723861476419-seed-resources.d.ts +5 -0
- package/dist-server/migrations/1723861476419-seed-resources.js +57 -0
- package/dist-server/migrations/1723861476419-seed-resources.js.map +1 -0
- package/dist-server/migrations/1723861478420-seed-/bsample-project.d.ts +5 -0
- package/dist-server/migrations/1723861478420-seed-/bsample-project.js +68 -0
- package/dist-server/migrations/1723861478420-seed-/bsample-project.js.map +1 -0
- package/dist-server/migrations/1723861478421-seed-/bsample-tasks.d.ts +5 -0
- package/dist-server/migrations/1723861478421-seed-/bsample-tasks.js +189 -0
- package/dist-server/migrations/1723861478421-seed-/bsample-tasks.js.map +1 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-mutation.d.ts +6 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-mutation.js +56 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-mutation.js.map +1 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-query.d.ts +9 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-query.js +53 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-query.js.map +1 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-type.d.ts +11 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-type.js +43 -0
- package/dist-server/service/construction-detail-type/construction-detail-type-type.js.map +1 -0
- package/dist-server/service/construction-detail-type/construction-detail-type.d.ts +15 -0
- package/dist-server/service/construction-detail-type/construction-detail-type.js +69 -0
- package/dist-server/service/construction-detail-type/construction-detail-type.js.map +1 -0
- package/dist-server/service/construction-detail-type/index.d.ts +5 -0
- package/dist-server/service/construction-detail-type/index.js +9 -0
- package/dist-server/service/construction-detail-type/index.js.map +1 -0
- package/dist-server/service/construction-type/construction-type-query.d.ts +2 -0
- package/dist-server/service/construction-type/construction-type-query.js +14 -0
- package/dist-server/service/construction-type/construction-type-query.js.map +1 -1
- package/dist-server/service/construction-type/construction-type.d.ts +2 -0
- package/dist-server/service/construction-type/construction-type.js +6 -0
- package/dist-server/service/construction-type/construction-type.js.map +1 -1
- package/dist-server/service/index.d.ts +7 -5
- package/dist-server/service/index.js +21 -10
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/inspection-drawing-type/index.d.ts +5 -0
- package/dist-server/service/inspection-drawing-type/index.js +9 -0
- package/dist-server/service/inspection-drawing-type/index.js.map +1 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.d.ts +6 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.js +64 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-mutation.js.map +1 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.d.ts +12 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.js +83 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-query.js.map +1 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.d.ts +10 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.js +39 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type-type.js.map +1 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type.d.ts +16 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type.js +72 -0
- package/dist-server/service/inspection-drawing-type/inspection-drawing-type.js.map +1 -0
- package/dist-server/service/inspection-part/index.d.ts +5 -0
- package/dist-server/service/inspection-part/index.js +9 -0
- package/dist-server/service/inspection-part/index.js.map +1 -0
- package/dist-server/service/inspection-part/inspection-part-mutation.d.ts +6 -0
- package/dist-server/service/inspection-part/inspection-part-mutation.js +55 -0
- package/dist-server/service/inspection-part/inspection-part-mutation.js.map +1 -0
- package/dist-server/service/inspection-part/inspection-part-query.d.ts +10 -0
- package/dist-server/service/inspection-part/inspection-part-query.js +66 -0
- package/dist-server/service/inspection-part/inspection-part-query.js.map +1 -0
- package/dist-server/service/inspection-part/inspection-part-type.d.ts +11 -0
- package/dist-server/service/inspection-part/inspection-part-type.js +43 -0
- package/dist-server/service/inspection-part/inspection-part-type.js.map +1 -0
- package/dist-server/service/inspection-part/inspection-part.d.ts +15 -0
- package/dist-server/service/inspection-part/inspection-part.js +69 -0
- package/dist-server/service/inspection-part/inspection-part.js.map +1 -0
- package/dist-server/service/project/index.d.ts +0 -2
- package/dist-server/service/project/index.js +1 -3
- package/dist-server/service/project/index.js.map +1 -1
- package/dist-server/service/project/project-query.d.ts +7 -5
- package/dist-server/service/project/project-query.js +34 -38
- package/dist-server/service/project/project-query.js.map +1 -1
- package/dist-server/service/project/project-type.d.ts +3 -6
- package/dist-server/service/project/project-type.js +25 -35
- package/dist-server/service/project/project-type.js.map +1 -1
- package/dist-server/service/project/project.d.ts +3 -2
- package/dist-server/service/project/project.js +10 -10
- package/dist-server/service/project/project.js.map +1 -1
- package/dist-server/service/resource/index.d.ts +6 -0
- package/dist-server/service/resource/index.js +10 -0
- package/dist-server/service/resource/index.js.map +1 -0
- package/dist-server/service/resource/resource-mutation.d.ts +10 -0
- package/dist-server/service/resource/resource-mutation.js +132 -0
- package/dist-server/service/resource/resource-mutation.js.map +1 -0
- package/dist-server/service/resource/resource-query.d.ts +11 -0
- package/dist-server/service/{checklist/checklist-query.js → resource/resource-query.js} +33 -38
- package/dist-server/service/resource/resource-query.js.map +1 -0
- package/dist-server/service/resource/resource-type.d.ts +17 -0
- package/dist-server/service/resource/resource-type.js +65 -0
- package/dist-server/service/resource/resource-type.js.map +1 -0
- package/dist-server/service/resource/resource.d.ts +24 -0
- package/dist-server/service/resource/resource.js +93 -0
- package/dist-server/service/resource/resource.js.map +1 -0
- package/dist-server/service/task/task-mutation.js +6 -0
- package/dist-server/service/task/task-mutation.js.map +1 -1
- package/dist-server/service/task/task-query.d.ts +9 -1
- package/dist-server/service/task/task-query.js +142 -20
- package/dist-server/service/task/task-query.js.map +1 -1
- package/dist-server/service/task/task-type.d.ts +13 -0
- package/dist-server/service/task/task-type.js +57 -12
- package/dist-server/service/task/task-type.js.map +1 -1
- package/dist-server/service/task/task.d.ts +12 -5
- package/dist-server/service/task/task.js +51 -16
- package/dist-server/service/task/task.js.map +1 -1
- package/dist-server/service/task-resource/index.d.ts +6 -0
- package/dist-server/service/task-resource/index.js +10 -0
- package/dist-server/service/task-resource/index.js.map +1 -0
- package/dist-server/service/task-resource/task-resource-mutation.d.ts +10 -0
- package/dist-server/service/task-resource/task-resource-mutation.js +132 -0
- package/dist-server/service/task-resource/task-resource-mutation.js.map +1 -0
- package/dist-server/service/task-resource/task-resource-query.d.ts +7 -0
- package/dist-server/service/task-resource/task-resource-query.js +50 -0
- package/dist-server/service/task-resource/task-resource-query.js.map +1 -0
- package/dist-server/service/task-resource/task-resource-type.d.ts +17 -0
- package/dist-server/service/task-resource/task-resource-type.js +65 -0
- package/dist-server/service/task-resource/task-resource-type.js.map +1 -0
- package/dist-server/service/task-resource/task-resource.d.ts +13 -0
- package/dist-server/service/task-resource/task-resource.js +59 -0
- package/dist-server/service/task-resource/task-resource.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/project/checklist-type-detail.md +160 -0
- package/helps/project/checklist-type.md +160 -0
- package/helps/project/task-resource.md +160 -0
- package/package.json +11 -7
- package/server/controllers/import-task.ts +140 -0
- package/server/index.ts +1 -0
- package/server/migrations/1723861466413-seed-roles.ts +128 -0
- package/server/migrations/1723861466414-seed-codes.ts +139 -0
- package/server/migrations/1723861476419-seed-resources.ts +62 -0
- package/server/migrations/1723861478420-seed-/bsample-project.ts +87 -0
- package/server/migrations/1723861478421-seed-/bsample-tasks.ts +194 -0
- package/server/migrations/index.ts +9 -0
- package/server/service/construction-detail-type/construction-detail-type-mutation.ts +57 -0
- package/server/service/construction-detail-type/construction-detail-type-query.ts +31 -0
- package/server/service/construction-detail-type/construction-detail-type-type.ts +26 -0
- package/server/service/construction-detail-type/construction-detail-type.ts +52 -0
- package/server/service/construction-detail-type/index.ts +6 -0
- package/server/service/construction-type/construction-type-query.ts +9 -0
- package/server/service/construction-type/construction-type.ts +8 -2
- package/server/service/index.ts +24 -11
- package/server/service/inspection-drawing-type/index.ts +6 -0
- package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +69 -0
- package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +55 -0
- package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +23 -0
- package/server/service/inspection-drawing-type/inspection-drawing-type.ts +68 -0
- package/server/service/inspection-part/index.ts +6 -0
- package/server/service/inspection-part/inspection-part-mutation.ts +52 -0
- package/server/service/inspection-part/inspection-part-query.ts +41 -0
- package/server/service/inspection-part/inspection-part-type.ts +26 -0
- package/server/service/inspection-part/inspection-part.ts +51 -0
- package/server/service/project/index.ts +0 -2
- package/server/service/project/project-query.ts +30 -38
- package/server/service/project/project-type.ts +22 -27
- package/server/service/project/project.ts +11 -12
- package/server/service/resource/index.ts +7 -0
- package/server/service/resource/resource-mutation.ts +137 -0
- package/server/service/resource/resource-query.ts +50 -0
- package/server/service/resource/resource-type.ts +41 -0
- package/server/service/resource/resource.ts +82 -0
- package/server/service/task/task-mutation.ts +8 -9
- package/server/service/task/task-query.ts +135 -22
- package/server/service/task/task-type.ts +41 -15
- package/server/service/task/task.ts +44 -15
- package/server/service/task-resource/index.ts +7 -0
- package/server/service/task-resource/task-resource-mutation.ts +140 -0
- package/server/service/task-resource/task-resource-query.ts +36 -0
- package/server/service/task-resource/task-resource-type.ts +41 -0
- package/server/service/task-resource/task-resource.ts +51 -0
- package/things-factory.config.js +1 -0
- package/translations/en.json +15 -1
- package/translations/ko.json +9 -5
- package/dist-client/pages/checklist/checklist-importer.js.map +0 -1
- package/dist-client/pages/checklist/checklist-list-page.js.map +0 -1
- package/dist-server/service/check-item/check-item-mutation.d.ts +0 -10
- package/dist-server/service/check-item/check-item-mutation.js +0 -129
- package/dist-server/service/check-item/check-item-mutation.js.map +0 -1
- package/dist-server/service/check-item/check-item-query.d.ts +0 -11
- package/dist-server/service/check-item/check-item-query.js +0 -86
- package/dist-server/service/check-item/check-item-query.js.map +0 -1
- package/dist-server/service/check-item/check-item-type.d.ts +0 -18
- package/dist-server/service/check-item/check-item-type.js +0 -69
- package/dist-server/service/check-item/check-item-type.js.map +0 -1
- package/dist-server/service/check-item/check-item.d.ts +0 -18
- package/dist-server/service/check-item/check-item.js +0 -84
- package/dist-server/service/check-item/check-item.js.map +0 -1
- package/dist-server/service/check-item/index.d.ts +0 -5
- package/dist-server/service/check-item/index.js +0 -9
- package/dist-server/service/check-item/index.js.map +0 -1
- package/dist-server/service/checklist/checklist-mutation.d.ts +0 -10
- package/dist-server/service/checklist/checklist-mutation.js +0 -129
- package/dist-server/service/checklist/checklist-mutation.js.map +0 -1
- package/dist-server/service/checklist/checklist-query.d.ts +0 -11
- package/dist-server/service/checklist/checklist-query.js.map +0 -1
- package/dist-server/service/checklist/checklist-type.d.ts +0 -18
- package/dist-server/service/checklist/checklist-type.js +0 -69
- package/dist-server/service/checklist/checklist-type.js.map +0 -1
- package/dist-server/service/checklist/checklist.d.ts +0 -26
- package/dist-server/service/checklist/checklist.js +0 -120
- package/dist-server/service/checklist/checklist.js.map +0 -1
- package/dist-server/service/checklist/index.d.ts +0 -5
- package/dist-server/service/checklist/index.js +0 -9
- package/dist-server/service/checklist/index.js.map +0 -1
- package/server/service/check-item/check-item-mutation.ts +0 -142
- package/server/service/check-item/check-item-query.ts +0 -56
- package/server/service/check-item/check-item-type.ts +0 -49
- package/server/service/check-item/check-item.ts +0 -74
- package/server/service/check-item/index.ts +0 -6
- package/server/service/checklist/checklist-mutation.ts +0 -142
- package/server/service/checklist/checklist-query.ts +0 -56
- package/server/service/checklist/checklist-type.ts +0 -49
- package/server/service/checklist/checklist.ts +0 -105
- package/server/service/checklist/index.ts +0 -6
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ProjectList = exports.ProjectPatch = exports.NewProject = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
6
|
const project_1 = require("./project");
|
|
7
|
-
const building_complex_1 = require("@dssp/building-complex");
|
|
8
7
|
const GraphQLUpload_js_1 = tslib_1.__importDefault(require("graphql-upload/GraphQLUpload.js"));
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
const building_complex_1 = require("@dssp/building-complex");
|
|
9
10
|
let NewProject = class NewProject {
|
|
10
11
|
};
|
|
11
12
|
tslib_1.__decorate([
|
|
12
|
-
(0, type_graphql_1.Field)({ nullable: false }),
|
|
13
|
+
(0, type_graphql_1.Field)({ nullable: false, description: '프로젝트 이름' }),
|
|
13
14
|
tslib_1.__metadata("design:type", String)
|
|
14
15
|
], NewProject.prototype, "name", void 0);
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, type_graphql_1.Field)(type => shell_1.ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' }),
|
|
18
|
+
tslib_1.__metadata("design:type", shell_1.ObjectRef)
|
|
19
|
+
], NewProject.prototype, "buildingComplex", void 0);
|
|
15
20
|
NewProject = tslib_1.__decorate([
|
|
16
21
|
(0, type_graphql_1.InputType)()
|
|
17
22
|
], NewProject);
|
|
@@ -19,52 +24,55 @@ exports.NewProject = NewProject;
|
|
|
19
24
|
let ProjectPatch = class ProjectPatch {
|
|
20
25
|
};
|
|
21
26
|
tslib_1.__decorate([
|
|
22
|
-
(0, type_graphql_1.Field)({ nullable: false }),
|
|
27
|
+
(0, type_graphql_1.Field)({ nullable: false, description: '수정할 프로젝트의 ID' }),
|
|
23
28
|
tslib_1.__metadata("design:type", String)
|
|
24
29
|
], ProjectPatch.prototype, "id", void 0);
|
|
25
30
|
tslib_1.__decorate([
|
|
26
|
-
(0, type_graphql_1.Field)({ nullable: false }),
|
|
31
|
+
(0, type_graphql_1.Field)({ nullable: false, description: '프로젝트 이름' }),
|
|
27
32
|
tslib_1.__metadata("design:type", String)
|
|
28
33
|
], ProjectPatch.prototype, "name", void 0);
|
|
29
34
|
tslib_1.__decorate([
|
|
30
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
35
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '프로젝트 착공일정' }),
|
|
31
36
|
tslib_1.__metadata("design:type", String)
|
|
32
37
|
], ProjectPatch.prototype, "startDate", void 0);
|
|
33
38
|
tslib_1.__decorate([
|
|
34
|
-
(0, type_graphql_1.Field)({ nullable: true }),
|
|
39
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '프로젝트 준공일정' }),
|
|
35
40
|
tslib_1.__metadata("design:type", String)
|
|
36
41
|
], ProjectPatch.prototype, "endDate", void 0);
|
|
37
42
|
tslib_1.__decorate([
|
|
38
|
-
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true }),
|
|
43
|
+
(0, type_graphql_1.Field)(type => GraphQLUpload_js_1.default, { nullable: true, description: '프로젝트 대표 사진 업로드' }),
|
|
39
44
|
tslib_1.__metadata("design:type", Object)
|
|
40
45
|
], ProjectPatch.prototype, "mainPhotoUpload", void 0);
|
|
41
46
|
tslib_1.__decorate([
|
|
42
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
47
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '프로젝트 전체 진행현황 (%)' }),
|
|
43
48
|
tslib_1.__metadata("design:type", Number)
|
|
44
49
|
], ProjectPatch.prototype, "totalProgress", void 0);
|
|
45
50
|
tslib_1.__decorate([
|
|
46
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
51
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '프로젝트 주간 진행현황 (%)' }),
|
|
47
52
|
tslib_1.__metadata("design:type", Number)
|
|
48
53
|
], ProjectPatch.prototype, "weeklyProgress", void 0);
|
|
49
54
|
tslib_1.__decorate([
|
|
50
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
55
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '프로젝트 KPI' }),
|
|
51
56
|
tslib_1.__metadata("design:type", Number)
|
|
52
57
|
], ProjectPatch.prototype, "kpi", void 0);
|
|
53
58
|
tslib_1.__decorate([
|
|
54
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
59
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '검측/통과 비율 (%)' }),
|
|
55
60
|
tslib_1.__metadata("design:type", Number)
|
|
56
61
|
], ProjectPatch.prototype, "inspPassRate", void 0);
|
|
57
62
|
tslib_1.__decorate([
|
|
58
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
63
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '로봇 작업 진행율 (%)' }),
|
|
59
64
|
tslib_1.__metadata("design:type", Number)
|
|
60
65
|
], ProjectPatch.prototype, "robotProgressRate", void 0);
|
|
61
66
|
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true }),
|
|
67
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: '구조 안전도 (%)' }),
|
|
63
68
|
tslib_1.__metadata("design:type", Number)
|
|
64
69
|
], ProjectPatch.prototype, "structuralSafetyRate", void 0);
|
|
65
70
|
tslib_1.__decorate([
|
|
66
71
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
67
|
-
tslib_1.__metadata("design:type", building_complex_1.BuildingComplexPatch
|
|
72
|
+
tslib_1.__metadata("design:type", building_complex_1.BuildingComplexPatch
|
|
73
|
+
// @Field(type => ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' })
|
|
74
|
+
// buildingComplex?: ObjectRef
|
|
75
|
+
)
|
|
68
76
|
], ProjectPatch.prototype, "buildingComplex", void 0);
|
|
69
77
|
ProjectPatch = tslib_1.__decorate([
|
|
70
78
|
(0, type_graphql_1.InputType)()
|
|
@@ -73,33 +81,15 @@ exports.ProjectPatch = ProjectPatch;
|
|
|
73
81
|
let ProjectList = class ProjectList {
|
|
74
82
|
};
|
|
75
83
|
tslib_1.__decorate([
|
|
76
|
-
(0, type_graphql_1.Field)(type => [project_1.Project]),
|
|
84
|
+
(0, type_graphql_1.Field)(type => [project_1.Project], { description: '프로젝트 리스트 항목들' }),
|
|
77
85
|
tslib_1.__metadata("design:type", Array)
|
|
78
86
|
], ProjectList.prototype, "items", void 0);
|
|
79
87
|
tslib_1.__decorate([
|
|
80
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
88
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: '전체 프로젝트 수' }),
|
|
81
89
|
tslib_1.__metadata("design:type", Number)
|
|
82
90
|
], ProjectList.prototype, "total", void 0);
|
|
83
91
|
ProjectList = tslib_1.__decorate([
|
|
84
92
|
(0, type_graphql_1.ObjectType)()
|
|
85
93
|
], ProjectList);
|
|
86
94
|
exports.ProjectList = ProjectList;
|
|
87
|
-
let InspectionSummary = class InspectionSummary {
|
|
88
|
-
};
|
|
89
|
-
tslib_1.__decorate([
|
|
90
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
91
|
-
tslib_1.__metadata("design:type", Number)
|
|
92
|
-
], InspectionSummary.prototype, "request", void 0);
|
|
93
|
-
tslib_1.__decorate([
|
|
94
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
95
|
-
tslib_1.__metadata("design:type", Number)
|
|
96
|
-
], InspectionSummary.prototype, "pass", void 0);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
99
|
-
tslib_1.__metadata("design:type", Number)
|
|
100
|
-
], InspectionSummary.prototype, "fail", void 0);
|
|
101
|
-
InspectionSummary = tslib_1.__decorate([
|
|
102
|
-
(0, type_graphql_1.ObjectType)()
|
|
103
|
-
], InspectionSummary);
|
|
104
|
-
exports.InspectionSummary = InspectionSummary;
|
|
105
95
|
//# sourceMappingURL=project-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-type.js","sourceRoot":"","sources":["../../../server/service/project/project-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAuE;AACvE,uCAAmC;
|
|
1
|
+
{"version":3,"file":"project-type.js","sourceRoot":"","sources":["../../../server/service/project/project-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAuE;AACvE,uCAAmC;AAEnC,+FAA2D;AAC3D,iDAA+D;AAC/D,6DAA6D;AAGtD,IAAM,UAAU,GAAhB,MAAM,UAAU;CAMtB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;;wCACvC;AAEZ;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;sCACjE,iBAAS;mDAAA;AALhB,UAAU;IADtB,IAAA,wBAAS,GAAE;GACC,UAAU,CAMtB;AANY,gCAAU;AAShB,IAAM,YAAY,GAAlB,MAAM,YAAY;CAuCxB,CAAA;AAtCC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EA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EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;0DACvC;AAE7B;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACR,uCAAoB;IAEtC,sFAAsF;IACtF,8BAA8B;;qDAHQ;AAnC3B,YAAY;IADxB,IAAA,wBAAS,GAAE;GACC,YAAY,CAuCxB;AAvCY,oCAAY;AA0ClB,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,iBAAO,CAAC,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;;0CAC1C;AAEhB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;;0CACpC;AALF,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AANY,kCAAW","sourcesContent":["import { ObjectType, Field, InputType, Int, Float } from 'type-graphql'\nimport { Project } from './project'\nimport type { FileUpload } from 'graphql-upload/GraphQLUpload.js'\nimport GraphQLUpload from 'graphql-upload/GraphQLUpload.js'\nimport { ObjectRef, ScalarObject } from '@things-factory/shell'\nimport { BuildingComplexPatch } from '@dssp/building-complex'\n\n@InputType()\nexport class NewProject {\n @Field({ nullable: false, description: '프로젝트 이름' })\n name: string\n\n @Field(type => ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' })\n buildingComplex?: ObjectRef\n}\n\n@InputType()\nexport class ProjectPatch {\n @Field({ nullable: false, description: '수정할 프로젝트의 ID' })\n id: string\n\n @Field({ nullable: false, description: '프로젝트 이름' })\n name: string\n\n @Field({ nullable: true, description: '프로젝트 착공일정' })\n startDate?: string\n\n @Field({ nullable: true, description: '프로젝트 준공일정' })\n endDate?: string\n\n @Field(type => GraphQLUpload, { nullable: true, description: '프로젝트 대표 사진 업로드' })\n mainPhotoUpload?: FileUpload\n\n @Field(type => Float, { nullable: true, description: '프로젝트 전체 진행현황 (%)' })\n totalProgress?: number\n\n @Field(type => Float, { nullable: true, description: '프로젝트 주간 진행현황 (%)' })\n weeklyProgress?: number\n\n @Field(type => Float, { nullable: true, description: '프로젝트 KPI' })\n kpi?: number\n\n @Field(type => Float, { nullable: true, description: '검측/통과 비율 (%)' })\n inspPassRate?: number\n\n @Field(type => Float, { nullable: true, description: '로봇 작업 진행율 (%)' })\n robotProgressRate?: number\n\n @Field(type => Float, { nullable: true, description: '구조 안전도 (%)' })\n structuralSafetyRate?: number\n\n @Field({ nullable: true })\n buildingComplex?: BuildingComplexPatch\n\n // @Field(type => ObjectRef, { nullable: true, description: '연관된 건물 복합체 정보 (선택 사항)' })\n // buildingComplex?: ObjectRef\n}\n\n@ObjectType()\nexport class ProjectList {\n @Field(type => [Project], { description: '프로젝트 리스트 항목들' })\n items: Project[]\n\n @Field(type => Int, { description: '전체 프로젝트 수' })\n total: number\n}\n"]}
|
|
@@ -4,8 +4,8 @@ import { Task } from '../task/task';
|
|
|
4
4
|
import { BuildingComplex } from '@dssp/building-complex';
|
|
5
5
|
import { Attachment } from '@things-factory/attachment-base';
|
|
6
6
|
export declare enum ProjectStatus {
|
|
7
|
-
'
|
|
8
|
-
'
|
|
7
|
+
'ONGOING' = "10",
|
|
8
|
+
'COMPLETED' = "20"
|
|
9
9
|
}
|
|
10
10
|
export declare class Project {
|
|
11
11
|
readonly id: string;
|
|
@@ -25,6 +25,7 @@ export declare class Project {
|
|
|
25
25
|
buildingComplex?: BuildingComplex;
|
|
26
26
|
buildingComplexId?: string;
|
|
27
27
|
tasks?: Task[];
|
|
28
|
+
rootTasks?: Task[];
|
|
28
29
|
createdAt?: Date;
|
|
29
30
|
updatedAt?: Date;
|
|
30
31
|
deletedAt?: Date;
|
|
@@ -11,13 +11,9 @@ const building_complex_1 = require("@dssp/building-complex");
|
|
|
11
11
|
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
12
12
|
var ProjectStatus;
|
|
13
13
|
(function (ProjectStatus) {
|
|
14
|
-
ProjectStatus["
|
|
15
|
-
ProjectStatus["
|
|
14
|
+
ProjectStatus["ONGOING"] = "10";
|
|
15
|
+
ProjectStatus["COMPLETED"] = "20";
|
|
16
16
|
})(ProjectStatus = exports.ProjectStatus || (exports.ProjectStatus = {}));
|
|
17
|
-
(0, type_graphql_1.registerEnumType)(ProjectStatus, {
|
|
18
|
-
name: 'ProjectStatus',
|
|
19
|
-
description: '프로젝트 상태'
|
|
20
|
-
});
|
|
21
17
|
let Project = class Project {
|
|
22
18
|
};
|
|
23
19
|
tslib_1.__decorate([
|
|
@@ -40,7 +36,7 @@ tslib_1.__decorate([
|
|
|
40
36
|
tslib_1.__metadata("design:type", String)
|
|
41
37
|
], Project.prototype, "name", void 0);
|
|
42
38
|
tslib_1.__decorate([
|
|
43
|
-
(0, typeorm_1.Column)({ nullable: false, default: ProjectStatus.
|
|
39
|
+
(0, typeorm_1.Column)({ nullable: false, default: ProjectStatus.ONGOING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' }),
|
|
44
40
|
(0, type_graphql_1.Field)({ nullable: false }),
|
|
45
41
|
tslib_1.__metadata("design:type", String)
|
|
46
42
|
], Project.prototype, "state", void 0);
|
|
@@ -99,10 +95,14 @@ tslib_1.__decorate([
|
|
|
99
95
|
tslib_1.__metadata("design:type", String)
|
|
100
96
|
], Project.prototype, "buildingComplexId", void 0);
|
|
101
97
|
tslib_1.__decorate([
|
|
102
|
-
(0, type_graphql_1.Field)(() => [task_1.Task], { nullable: true }),
|
|
103
98
|
(0, typeorm_1.OneToMany)(() => task_1.Task, task => task.project),
|
|
99
|
+
(0, type_graphql_1.Field)(() => [task_1.Task], { nullable: true }),
|
|
104
100
|
tslib_1.__metadata("design:type", Array)
|
|
105
101
|
], Project.prototype, "tasks", void 0);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, type_graphql_1.Field)(() => [task_1.Task], { nullable: true }),
|
|
104
|
+
tslib_1.__metadata("design:type", Array)
|
|
105
|
+
], Project.prototype, "rootTasks", void 0);
|
|
106
106
|
tslib_1.__decorate([
|
|
107
107
|
(0, typeorm_1.CreateDateColumn)(),
|
|
108
108
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
@@ -137,9 +137,9 @@ tslib_1.__decorate([
|
|
|
137
137
|
tslib_1.__metadata("design:type", String)
|
|
138
138
|
], Project.prototype, "updaterId", void 0);
|
|
139
139
|
Project = tslib_1.__decorate([
|
|
140
|
+
(0, type_graphql_1.ObjectType)({ description: '프로젝트' }),
|
|
140
141
|
(0, typeorm_1.Entity)(),
|
|
141
|
-
(0, typeorm_1.Index)('
|
|
142
|
-
(0, type_graphql_1.ObjectType)({ description: '프로젝트' })
|
|
142
|
+
(0, typeorm_1.Index)('ix_project_building', (project) => [project.buildingComplex], { unique: true, where: '"deleted_at" IS NULL' })
|
|
143
143
|
], Project);
|
|
144
144
|
exports.Project = Project;
|
|
145
145
|
//# sourceMappingURL=project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../server/service/project/project.ts"],"names":[],"mappings":";;;;AAAA,qCAagB;AAChB,+
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../server/service/project/project.ts"],"names":[],"mappings":";;;;AAAA,qCAagB;AAChB,+CAAoD;AAEpD,iDAAgE;AAChE,yDAAgD;AAChD,uCAAmC;AACnC,6DAAwD;AACxD,qEAA4D;AAE5D,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,+BAAgB,CAAA;IAChB,iCAAkB,CAAA;AACpB,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAKM,IAAM,OAAO,GAAb,MAAM,OAAO;CAmGnB,CAAA;AAlGC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,C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BAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;wCAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAElB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,gBAAI;wCAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;;0CAChC;AAlGP,OAAO;IAHnB,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IACnC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;GAClH,OAAO,CAmGnB;AAnGY,0BAAO","sourcesContent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Index,\n Column,\n RelationId,\n ManyToOne,\n OneToOne,\n OneToMany,\n JoinColumn,\n PrimaryGeneratedColumn\n} from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { Domain, roundTransformer } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Task } from '../task/task'\nimport { BuildingComplex } from '@dssp/building-complex'\nimport { Attachment } from '@things-factory/attachment-base'\n\nexport enum ProjectStatus {\n 'ONGOING' = '10',\n 'COMPLETED' = '20'\n}\n\n@ObjectType({ description: '프로젝트' })\n@Entity()\n@Index('ix_project_building', (project: Project) => [project.buildingComplex], { unique: true, where: '\"deleted_at\" IS NULL' })\nexport class Project {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((project: Project) => project.domain)\n domainId?: string\n\n @Column({ nullable: false, comment: '프로젝트 이름' })\n @Field({ nullable: false })\n name?: string\n\n @Column({ nullable: false, default: ProjectStatus.ONGOING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' })\n @Field({ nullable: false })\n state?: ProjectStatus\n\n @Column({ type: 'date', nullable: true, comment: '착공일정' })\n @Field({ nullable: true })\n startDate?: string\n\n @Column({ type: 'date', nullable: true, comment: '준공일정' })\n @Field({ nullable: true })\n endDate?: string\n\n // 대표 사진\n @Field(type => Attachment, { nullable: true })\n mainPhoto?: Attachment\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: '전체 진행현황' })\n @Field({ nullable: true })\n totalProgress?: number\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: '주간 진행현황' })\n @Field({ nullable: true })\n weeklyProgress?: number\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: 'KPI' })\n @Field({ nullable: true })\n kpi?: number\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: '검측/통과 비율' })\n @Field({ nullable: true })\n inspPassRate?: number\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: '로봇 작업 진행율' })\n @Field({ nullable: true })\n robotProgressRate?: number\n\n @Column({ type: 'float', nullable: true, default: 0, transformer: roundTransformer, comment: '구조 안전도' })\n @Field({ nullable: true })\n structuralSafetyRate?: number\n\n // 단지 정보 (1:1 테이블 참조)\n @OneToOne(type => BuildingComplex)\n @JoinColumn()\n @Field({ nullable: true })\n buildingComplex?: BuildingComplex\n\n @RelationId((project: Project) => project.buildingComplex)\n buildingComplexId?: string\n\n // 작업 정보 (하위 테이블 참조)\n @OneToMany(() => Task, task => task.project)\n @Field(() => [Task], { nullable: true })\n tasks?: Task[]\n\n // 루트 작업 정보 (부모가 없는 상위 작업)\n @Field(() => [Task], { nullable: true })\n rootTasks?: Task[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((project: Project) => project.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((project: Project) => project.updater)\n updaterId?: string\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Resource } from './resource';
|
|
2
|
+
import { ResourceQuery } from './resource-query';
|
|
3
|
+
import { ResourceMutation } from './resource-mutation';
|
|
4
|
+
export declare const entities: (typeof Resource)[];
|
|
5
|
+
export declare const resolvers: (typeof ResourceQuery | typeof ResourceMutation)[];
|
|
6
|
+
export declare const subscribers: any[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscribers = exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const resource_1 = require("./resource");
|
|
5
|
+
const resource_query_1 = require("./resource-query");
|
|
6
|
+
const resource_mutation_1 = require("./resource-mutation");
|
|
7
|
+
exports.entities = [resource_1.Resource];
|
|
8
|
+
exports.resolvers = [resource_query_1.ResourceQuery, resource_mutation_1.ResourceMutation];
|
|
9
|
+
exports.subscribers = [];
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/resource/index.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qDAAgD;AAChD,2DAAsD;AAEzC,QAAA,QAAQ,GAAG,CAAC,mBAAQ,CAAC,CAAA;AACrB,QAAA,SAAS,GAAG,CAAC,8BAAa,EAAE,oCAAgB,CAAC,CAAA;AAC7C,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { Resource } from './resource'\nimport { ResourceQuery } from './resource-query'\nimport { ResourceMutation } from './resource-mutation'\n\nexport const entities = [Resource]\nexport const resolvers = [ResourceQuery, ResourceMutation]\nexport const subscribers = []\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Resource } from './resource';
|
|
2
|
+
import { NewResource, ResourcePatch } from './resource-type';
|
|
3
|
+
export declare class ResourceMutation {
|
|
4
|
+
createResource(resource: NewResource, context: ResolverContext): Promise<Resource>;
|
|
5
|
+
updateResource(id: string, patch: ResourcePatch, context: ResolverContext): Promise<Resource>;
|
|
6
|
+
updateMultipleResource(patches: ResourcePatch[], context: ResolverContext): Promise<Resource[]>;
|
|
7
|
+
deleteResource(id: string, context: ResolverContext): Promise<boolean>;
|
|
8
|
+
deleteResources(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
9
|
+
importResources(resources: ResourcePatch[], context: ResolverContext): Promise<boolean>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceMutation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const resource_1 = require("./resource");
|
|
8
|
+
const resource_type_1 = require("./resource-type");
|
|
9
|
+
let ResourceMutation = class ResourceMutation {
|
|
10
|
+
async createResource(resource, context) {
|
|
11
|
+
const { domain, user, tx } = context.state;
|
|
12
|
+
const result = await tx.getRepository(resource_1.Resource).save(Object.assign(Object.assign({}, resource), { domain, creator: user, updater: user }));
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
async updateResource(id, patch, context) {
|
|
16
|
+
const { domain, user, tx } = context.state;
|
|
17
|
+
const repository = tx.getRepository(resource_1.Resource);
|
|
18
|
+
const resource = await repository.findOne({
|
|
19
|
+
where: { domain: { id: domain.id }, id }
|
|
20
|
+
});
|
|
21
|
+
const result = await repository.save(Object.assign(Object.assign(Object.assign({}, resource), patch), { updater: user }));
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
async updateMultipleResource(patches, context) {
|
|
25
|
+
const { domain, user, tx } = context.state;
|
|
26
|
+
let results = [];
|
|
27
|
+
const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
|
|
28
|
+
const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
|
|
29
|
+
const resourceRepo = tx.getRepository(resource_1.Resource);
|
|
30
|
+
if (_createRecords.length > 0) {
|
|
31
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
32
|
+
const newRecord = _createRecords[i];
|
|
33
|
+
const result = await resourceRepo.save(Object.assign(Object.assign({}, newRecord), { domain, creator: user, updater: user }));
|
|
34
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (_updateRecords.length > 0) {
|
|
38
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
39
|
+
const updateRecord = _updateRecords[i];
|
|
40
|
+
const resource = await resourceRepo.findOneBy({ id: updateRecord.id });
|
|
41
|
+
const result = await resourceRepo.save(Object.assign(Object.assign(Object.assign({}, resource), updateRecord), { updater: user }));
|
|
42
|
+
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return results;
|
|
46
|
+
}
|
|
47
|
+
async deleteResource(id, context) {
|
|
48
|
+
const { domain, tx } = context.state;
|
|
49
|
+
await tx.getRepository(resource_1.Resource).delete({ domain: { id: domain.id }, id });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
async deleteResources(ids, context) {
|
|
53
|
+
const { domain, tx } = context.state;
|
|
54
|
+
await tx.getRepository(resource_1.Resource).delete({
|
|
55
|
+
domain: { id: domain.id },
|
|
56
|
+
id: (0, typeorm_1.In)(ids)
|
|
57
|
+
});
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
async importResources(resources, context) {
|
|
61
|
+
const { domain, tx } = context.state;
|
|
62
|
+
await Promise.all(resources.map(async (resource) => {
|
|
63
|
+
const createdResource = await tx.getRepository(resource_1.Resource).save(Object.assign({ domain }, resource));
|
|
64
|
+
}));
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
70
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
71
|
+
(0, type_graphql_1.Mutation)(returns => resource_1.Resource, { description: 'To create new Resource' }),
|
|
72
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('resource')),
|
|
73
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
74
|
+
tslib_1.__metadata("design:type", Function),
|
|
75
|
+
tslib_1.__metadata("design:paramtypes", [resource_type_1.NewResource, Object]),
|
|
76
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
77
|
+
], ResourceMutation.prototype, "createResource", null);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
80
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
81
|
+
(0, type_graphql_1.Mutation)(returns => resource_1.Resource, { description: 'To modify Resource information' }),
|
|
82
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
83
|
+
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
84
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
85
|
+
tslib_1.__metadata("design:type", Function),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [String, resource_type_1.ResourcePatch, Object]),
|
|
87
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
88
|
+
], ResourceMutation.prototype, "updateResource", null);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
91
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
92
|
+
(0, type_graphql_1.Mutation)(returns => [resource_1.Resource], { description: "To modify multiple Resources' information" }),
|
|
93
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [resource_type_1.ResourcePatch])),
|
|
94
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
95
|
+
tslib_1.__metadata("design:type", Function),
|
|
96
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
97
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
98
|
+
], ResourceMutation.prototype, "updateMultipleResource", null);
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
101
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
102
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Resource' }),
|
|
103
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
104
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
105
|
+
tslib_1.__metadata("design:type", Function),
|
|
106
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
107
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
108
|
+
], ResourceMutation.prototype, "deleteResource", null);
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
111
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Resources' }),
|
|
112
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
113
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
114
|
+
tslib_1.__metadata("design:type", Function),
|
|
115
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
116
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
117
|
+
], ResourceMutation.prototype, "deleteResources", null);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
120
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
121
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Resources' }),
|
|
122
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('resources', type => [resource_type_1.ResourcePatch])),
|
|
123
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
124
|
+
tslib_1.__metadata("design:type", Function),
|
|
125
|
+
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
126
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
127
|
+
], ResourceMutation.prototype, "importResources", null);
|
|
128
|
+
ResourceMutation = tslib_1.__decorate([
|
|
129
|
+
(0, type_graphql_1.Resolver)(resource_1.Resource)
|
|
130
|
+
], ResourceMutation);
|
|
131
|
+
exports.ResourceMutation = ResourceMutation;
|
|
132
|
+
//# sourceMappingURL=resource-mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-mutation.js","sourceRoot":"","sources":["../../../server/service/resource/resource-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,yCAAqC;AACrC,mDAA4D;AAGrD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAIrB,AAAN,KAAK,CAAC,cAAc,CAAkB,QAA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AE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDASxE;AAKK;IAHL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,wBAAS,EAAC,kFAAkF,CAAC;IAC7F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAE3E,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,6BAAa,CAAC,CAAC,CAAA;IACzC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAWP;AAhIU,gBAAgB;IAD5B,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,gBAAgB,CAiI5B;AAjIY,4CAAgB","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { Resource } from './resource'\nimport { NewResource, ResourcePatch } from './resource-type'\n\n@Resolver(Resource)\nexport class ResourceMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Resource, { description: 'To create new Resource' })\n async createResource(@Arg('resource') resource: NewResource, @Ctx() context: ResolverContext): Promise<Resource> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Resource).save({\n ...resource,\n domain,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Resource, { description: 'To modify Resource information' })\n async updateResource(\n @Arg('id') id: string,\n @Arg('patch') patch: ResourcePatch,\n @Ctx() context: ResolverContext\n ): Promise<Resource> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Resource)\n const resource = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n const result = await repository.save({\n ...resource,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => [Resource], { description: \"To modify multiple Resources' information\" })\n async updateMultipleResource(\n @Arg('patches', type => [ResourcePatch]) patches: ResourcePatch[],\n @Ctx() context: ResolverContext\n ): Promise<Resource[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const resourceRepo = tx.getRepository(Resource)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await resourceRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const updateRecord = _updateRecords[i]\n const resource = await resourceRepo.findOneBy({ id: updateRecord.id })\n\n const result = await resourceRepo.save({\n ...resource,\n ...updateRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete Resource' })\n async deleteResource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Resource).delete({ domain: { id: domain.id }, id })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Resources' })\n async deleteResources(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Resource).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To import multiple Resources' })\n async importResources(\n @Arg('resources', type => [ResourcePatch]) resources: ResourcePatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n resources.map(async (resource: ResourcePatch) => {\n const createdResource: Resource = await tx.getRepository(Resource).save({ domain, ...resource })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Domain, ListParam } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { Resource } from './resource';
|
|
4
|
+
import { ResourceList } from './resource-type';
|
|
5
|
+
export declare class ResourceQuery {
|
|
6
|
+
resource(id: string, context: ResolverContext): Promise<Resource>;
|
|
7
|
+
resources(params: ListParam, context: ResolverContext): Promise<ResourceList>;
|
|
8
|
+
domain(resource: Resource): Promise<Domain>;
|
|
9
|
+
updater(resource: Resource): Promise<User>;
|
|
10
|
+
creator(resource: Resource): Promise<User>;
|
|
11
|
+
}
|
|
@@ -1,86 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ResourceQuery = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const type_graphql_1 = require("type-graphql");
|
|
6
|
-
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
7
6
|
const shell_1 = require("@things-factory/shell");
|
|
8
7
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
async
|
|
8
|
+
const resource_1 = require("./resource");
|
|
9
|
+
const resource_type_1 = require("./resource-type");
|
|
10
|
+
let ResourceQuery = class ResourceQuery {
|
|
11
|
+
async resource(id, context) {
|
|
13
12
|
const { domain } = context.state;
|
|
14
|
-
return await (0, shell_1.getRepository)(
|
|
15
|
-
where: { id }
|
|
13
|
+
return await (0, shell_1.getRepository)(resource_1.Resource).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id }
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
|
-
async
|
|
17
|
+
async resources(params, context) {
|
|
19
18
|
const { domain } = context.state;
|
|
20
19
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
21
20
|
domain,
|
|
22
21
|
params,
|
|
23
|
-
repository: await (0, shell_1.getRepository)(
|
|
22
|
+
repository: await (0, shell_1.getRepository)(resource_1.Resource),
|
|
24
23
|
searchables: ['name', 'description']
|
|
25
24
|
});
|
|
26
25
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
26
|
return { items, total };
|
|
28
27
|
}
|
|
29
|
-
async
|
|
30
|
-
|
|
31
|
-
where: {
|
|
32
|
-
refType: checklist_1.Checklist.name,
|
|
33
|
-
refBy: checklist.id
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
28
|
+
async domain(resource) {
|
|
29
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: resource.domainId });
|
|
37
30
|
}
|
|
38
|
-
async updater(
|
|
39
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id:
|
|
31
|
+
async updater(resource) {
|
|
32
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: resource.updaterId });
|
|
40
33
|
}
|
|
41
|
-
async creator(
|
|
42
|
-
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id:
|
|
34
|
+
async creator(resource) {
|
|
35
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: resource.creatorId });
|
|
43
36
|
}
|
|
44
37
|
};
|
|
45
38
|
tslib_1.__decorate([
|
|
46
|
-
(0, type_graphql_1.
|
|
39
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)'),
|
|
40
|
+
(0, type_graphql_1.Query)(returns => resource_1.Resource, { nullable: true, description: 'To fetch a Resource' }),
|
|
47
41
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
48
42
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
49
43
|
tslib_1.__metadata("design:type", Function),
|
|
50
44
|
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
51
45
|
tslib_1.__metadata("design:returntype", Promise)
|
|
52
|
-
],
|
|
46
|
+
], ResourceQuery.prototype, "resource", null);
|
|
53
47
|
tslib_1.__decorate([
|
|
54
|
-
(0, type_graphql_1.
|
|
48
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)'),
|
|
49
|
+
(0, type_graphql_1.Query)(returns => resource_type_1.ResourceList, { description: 'To fetch multiple Resources' }),
|
|
55
50
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
56
51
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
57
52
|
tslib_1.__metadata("design:type", Function),
|
|
58
53
|
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
59
54
|
tslib_1.__metadata("design:returntype", Promise)
|
|
60
|
-
],
|
|
55
|
+
], ResourceQuery.prototype, "resources", null);
|
|
61
56
|
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.FieldResolver)(type =>
|
|
57
|
+
(0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
|
|
63
58
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
64
59
|
tslib_1.__metadata("design:type", Function),
|
|
65
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
60
|
+
tslib_1.__metadata("design:paramtypes", [resource_1.Resource]),
|
|
66
61
|
tslib_1.__metadata("design:returntype", Promise)
|
|
67
|
-
],
|
|
62
|
+
], ResourceQuery.prototype, "domain", null);
|
|
68
63
|
tslib_1.__decorate([
|
|
69
64
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
70
65
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
71
66
|
tslib_1.__metadata("design:type", Function),
|
|
72
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
67
|
+
tslib_1.__metadata("design:paramtypes", [resource_1.Resource]),
|
|
73
68
|
tslib_1.__metadata("design:returntype", Promise)
|
|
74
|
-
],
|
|
69
|
+
], ResourceQuery.prototype, "updater", null);
|
|
75
70
|
tslib_1.__decorate([
|
|
76
71
|
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
77
72
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
78
73
|
tslib_1.__metadata("design:type", Function),
|
|
79
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
74
|
+
tslib_1.__metadata("design:paramtypes", [resource_1.Resource]),
|
|
80
75
|
tslib_1.__metadata("design:returntype", Promise)
|
|
81
|
-
],
|
|
82
|
-
|
|
83
|
-
(0, type_graphql_1.Resolver)(
|
|
84
|
-
],
|
|
85
|
-
exports.
|
|
86
|
-
//# sourceMappingURL=
|
|
76
|
+
], ResourceQuery.prototype, "creator", null);
|
|
77
|
+
ResourceQuery = tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.Resolver)(resource_1.Resource)
|
|
79
|
+
], ResourceQuery);
|
|
80
|
+
exports.ResourceQuery = ResourceQuery;
|
|
81
|
+
//# sourceMappingURL=resource-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-query.js","sourceRoot":"","sources":["../../../server/service/resource/resource-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,iDAAuG;AACvG,yDAAgD;AAChD,yCAAqC;AACrC,mDAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGlB,AAAN,KAAK,CAAC,QAAQ,CAAY,EAAU,EAAS,OAAwB;QACnE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,OAAO,MAA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AC1F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,mBAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACpE,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;6CAM3C;AAIK;IAFL,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,4BAAY,EAAE,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;IAC9D,mBAAA,IAAA,mBAAI,GAAE,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,iBAAS;;8CAaxC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;2CAEtC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAW,mBAAQ;;4CAEvC;AAzCU,aAAa;IADzB,IAAA,uBAAQ,EAAC,mBAAQ,CAAC;GACN,aAAa,CA0CzB;AA1CY,sCAAa","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Resource } from './resource'\nimport { ResourceList } from './resource-type'\n\n@Resolver(Resource)\nexport class ResourceQuery {\n @Directive('@privilege(category: \"project\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Resource!, { nullable: true, description: 'To fetch a Resource' })\n async resource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Resource> {\n const { domain } = context.state\n\n return await getRepository(Resource).findOne({\n where: { domain: { id: domain.id }, id }\n })\n }\n\n @Directive('@privilege(category: \"project\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => ResourceList, { description: 'To fetch multiple Resources' })\n async resources(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ResourceList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Resource),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() resource: Resource): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: resource.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() resource: Resource): Promise<User> {\n return await getRepository(User).findOneBy({ id: resource.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() resource: Resource): Promise<User> {\n return await getRepository(User).findOneBy({ id: resource.creatorId })\n }\n}\n"]}
|