@dssp/project 0.0.8 → 0.0.10
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 +111 -312
- 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 +117 -306
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Resource, ResourceType } from './resource';
|
|
2
|
+
export declare class NewResource {
|
|
3
|
+
name: string;
|
|
4
|
+
type: ResourceType;
|
|
5
|
+
unit: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class ResourcePatch {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
type?: ResourceType;
|
|
11
|
+
unit?: string;
|
|
12
|
+
cuFlag?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class ResourceList {
|
|
15
|
+
items: Resource[];
|
|
16
|
+
total: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceList = exports.ResourcePatch = exports.NewResource = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const resource_1 = require("./resource");
|
|
7
|
+
let NewResource = class NewResource {
|
|
8
|
+
};
|
|
9
|
+
tslib_1.__decorate([
|
|
10
|
+
(0, type_graphql_1.Field)(),
|
|
11
|
+
tslib_1.__metadata("design:type", String)
|
|
12
|
+
], NewResource.prototype, "name", void 0);
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, type_graphql_1.Field)(type => resource_1.ResourceType),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], NewResource.prototype, "type", void 0);
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], NewResource.prototype, "unit", void 0);
|
|
21
|
+
NewResource = tslib_1.__decorate([
|
|
22
|
+
(0, type_graphql_1.InputType)()
|
|
23
|
+
], NewResource);
|
|
24
|
+
exports.NewResource = NewResource;
|
|
25
|
+
let ResourcePatch = class ResourcePatch {
|
|
26
|
+
};
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], ResourcePatch.prototype, "id", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
33
|
+
tslib_1.__metadata("design:type", String)
|
|
34
|
+
], ResourcePatch.prototype, "name", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)(type => resource_1.ResourceType, { nullable: true }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], ResourcePatch.prototype, "type", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
41
|
+
tslib_1.__metadata("design:type", String)
|
|
42
|
+
], ResourcePatch.prototype, "unit", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], ResourcePatch.prototype, "cuFlag", void 0);
|
|
47
|
+
ResourcePatch = tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.InputType)()
|
|
49
|
+
], ResourcePatch);
|
|
50
|
+
exports.ResourcePatch = ResourcePatch;
|
|
51
|
+
let ResourceList = class ResourceList {
|
|
52
|
+
};
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, type_graphql_1.Field)(type => [resource_1.Resource]),
|
|
55
|
+
tslib_1.__metadata("design:type", Array)
|
|
56
|
+
], ResourceList.prototype, "items", void 0);
|
|
57
|
+
tslib_1.__decorate([
|
|
58
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int),
|
|
59
|
+
tslib_1.__metadata("design:type", Number)
|
|
60
|
+
], ResourceList.prototype, "total", void 0);
|
|
61
|
+
ResourceList = tslib_1.__decorate([
|
|
62
|
+
(0, type_graphql_1.ObjectType)()
|
|
63
|
+
], ResourceList);
|
|
64
|
+
exports.ResourceList = ResourceList;
|
|
65
|
+
//# sourceMappingURL=resource-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-type.js","sourceRoot":"","sources":["../../../server/service/resource/resource-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AACpE,yCAAmD;AAG5C,IAAM,WAAW,GAAjB,MAAM,WAAW;CASvB,CAAA;AARC;IAAC,IAAA,oBAAK,GAAE;;yCACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAY,CAAC;;yCACV;AAElB;IAAC,IAAA,oBAAK,GAAE;;yCACI;AARD,WAAW;IADvB,IAAA,wBAAS,GAAE;GACC,WAAW,CASvB;AATY,kCAAW;AAYjB,IAAM,aAAa,GAAnB,MAAM,aAAa;CAezB,CAAA;AAdC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCAC3B;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,uBAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC7B;AAEnB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACX;AAdJ,aAAa;IADzB,IAAA,wBAAS,GAAE;GACC,aAAa,CAezB;AAfY,sCAAa;AAkBnB,IAAM,YAAY,GAAlB,MAAM,YAAY;CAMxB,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,mBAAQ,CAAC,CAAC;;2CACT;AAEjB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;2CACN;AALF,YAAY;IADxB,IAAA,yBAAU,GAAE;GACA,YAAY,CAMxB;AANY,oCAAY","sourcesContent":["import { InputType, Field, ID, ObjectType, Int } from 'type-graphql'\nimport { Resource, ResourceType } from './resource'\n\n@InputType()\nexport class NewResource {\n @Field()\n name: string\n\n @Field(type => ResourceType)\n type: ResourceType\n\n @Field()\n unit: string\n}\n\n@InputType()\nexport class ResourcePatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field(type => ResourceType, { nullable: true })\n type?: ResourceType\n\n @Field({ nullable: true })\n unit?: string\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ResourceList {\n @Field(type => [Resource])\n items: Resource[]\n\n @Field(type => Int)\n total: number\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { User } from '@things-factory/auth-base';
|
|
3
|
+
import { TaskResource } from '../task-resource/task-resource';
|
|
4
|
+
export declare enum ResourceType {
|
|
5
|
+
HUMAN = "HUMAN",
|
|
6
|
+
MATERIAL = "MATERIAL",
|
|
7
|
+
EQUIPMENT = "EQUIPMENT"
|
|
8
|
+
}
|
|
9
|
+
export declare class Resource {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
domain?: Domain;
|
|
12
|
+
domainId?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
type: ResourceType;
|
|
15
|
+
unit: string;
|
|
16
|
+
createdAt?: Date;
|
|
17
|
+
updatedAt?: Date;
|
|
18
|
+
deletedAt?: Date;
|
|
19
|
+
creator?: User;
|
|
20
|
+
creatorId?: string;
|
|
21
|
+
updater?: User;
|
|
22
|
+
updaterId?: string;
|
|
23
|
+
taskResources?: TaskResource[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Resource = exports.ResourceType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const shell_1 = require("@things-factory/shell");
|
|
8
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
|
+
const task_resource_1 = require("../task-resource/task-resource");
|
|
10
|
+
var ResourceType;
|
|
11
|
+
(function (ResourceType) {
|
|
12
|
+
ResourceType["HUMAN"] = "HUMAN";
|
|
13
|
+
ResourceType["MATERIAL"] = "MATERIAL";
|
|
14
|
+
ResourceType["EQUIPMENT"] = "EQUIPMENT";
|
|
15
|
+
})(ResourceType = exports.ResourceType || (exports.ResourceType = {}));
|
|
16
|
+
(0, type_graphql_1.registerEnumType)(ResourceType, {
|
|
17
|
+
name: 'ResourceType',
|
|
18
|
+
description: '자원 유형'
|
|
19
|
+
});
|
|
20
|
+
let Resource = class Resource {
|
|
21
|
+
};
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
24
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID),
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
26
|
+
], Resource.prototype, "id", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
29
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
30
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
31
|
+
], Resource.prototype, "domain", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, typeorm_1.RelationId)((resource) => resource.domain),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], Resource.prototype, "domainId", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ nullable: false, comment: '자원 이름' }),
|
|
38
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], Resource.prototype, "name", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ nullable: false, default: ResourceType.HUMAN, comment: '자원 유형' }),
|
|
43
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
44
|
+
tslib_1.__metadata("design:type", String)
|
|
45
|
+
], Resource.prototype, "type", void 0);
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ nullable: false, comment: '단위 (예: man/day, kg, hour 등)' }),
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: false }),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], Resource.prototype, "unit", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
53
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
54
|
+
tslib_1.__metadata("design:type", Date)
|
|
55
|
+
], Resource.prototype, "createdAt", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
58
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
59
|
+
tslib_1.__metadata("design:type", Date)
|
|
60
|
+
], Resource.prototype, "updatedAt", void 0);
|
|
61
|
+
tslib_1.__decorate([
|
|
62
|
+
(0, typeorm_1.DeleteDateColumn)(),
|
|
63
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
64
|
+
tslib_1.__metadata("design:type", Date)
|
|
65
|
+
], Resource.prototype, "deletedAt", void 0);
|
|
66
|
+
tslib_1.__decorate([
|
|
67
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
68
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
69
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
70
|
+
], Resource.prototype, "creator", void 0);
|
|
71
|
+
tslib_1.__decorate([
|
|
72
|
+
(0, typeorm_1.RelationId)((resource) => resource.creator),
|
|
73
|
+
tslib_1.__metadata("design:type", String)
|
|
74
|
+
], Resource.prototype, "creatorId", void 0);
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
77
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true }),
|
|
78
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
79
|
+
], Resource.prototype, "updater", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, typeorm_1.RelationId)((resource) => resource.updater),
|
|
82
|
+
tslib_1.__metadata("design:type", String)
|
|
83
|
+
], Resource.prototype, "updaterId", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, typeorm_1.OneToMany)(() => task_resource_1.TaskResource, taskResource => taskResource.resource),
|
|
86
|
+
tslib_1.__metadata("design:type", Array)
|
|
87
|
+
], Resource.prototype, "taskResources", void 0);
|
|
88
|
+
Resource = tslib_1.__decorate([
|
|
89
|
+
(0, typeorm_1.Entity)(),
|
|
90
|
+
(0, type_graphql_1.ObjectType)({ description: '자원' })
|
|
91
|
+
], Resource);
|
|
92
|
+
exports.Resource = Resource;
|
|
93
|
+
//# sourceMappingURL=resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../server/service/resource/resource.ts"],"names":[],"mappings":";;;;AAAA,qCAUgB;AAChB,+CAAsE;AACtE,iDAA8C;AAC9C,yDAAgD;AAChD,kEAA6D;AAE7D,I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ent":["import {\n CreateDateColumn,\n UpdateDateColumn,\n DeleteDateColumn,\n Entity,\n Column,\n PrimaryGeneratedColumn,\n ManyToOne,\n RelationId,\n OneToMany\n} from 'typeorm'\nimport { ObjectType, Field, ID, registerEnumType } from 'type-graphql'\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { TaskResource } from '../task-resource/task-resource'\n\nexport enum ResourceType {\n HUMAN = 'HUMAN',\n MATERIAL = 'MATERIAL',\n EQUIPMENT = 'EQUIPMENT'\n}\n\nregisterEnumType(ResourceType, {\n name: 'ResourceType',\n description: '자원 유형'\n})\n\n@Entity()\n@ObjectType({ description: '자원' })\nexport class Resource {\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((resource: Resource) => resource.domain)\n domainId?: string\n\n @Column({ nullable: false, comment: '자원 이름' })\n @Field({ nullable: false })\n name?: string\n\n @Column({ nullable: false, default: ResourceType.HUMAN, comment: '자원 유형' })\n @Field({ nullable: false })\n type: ResourceType\n\n @Column({ nullable: false, comment: '단위 (예: man/day, kg, hour 등)' })\n @Field({ nullable: false })\n unit: string\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((resource: Resource) => resource.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((resource: Resource) => resource.updater)\n updaterId?: string\n\n @OneToMany(() => TaskResource, taskResource => taskResource.resource)\n taskResources?: TaskResource[]\n}\n"]}
|
|
@@ -69,6 +69,7 @@ let TaskMutation = class TaskMutation {
|
|
|
69
69
|
};
|
|
70
70
|
tslib_1.__decorate([
|
|
71
71
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
72
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
72
73
|
(0, type_graphql_1.Mutation)(returns => task_1.Task, { description: 'To create new Task' }),
|
|
73
74
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('task')),
|
|
74
75
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -78,6 +79,7 @@ tslib_1.__decorate([
|
|
|
78
79
|
], TaskMutation.prototype, "createTask", null);
|
|
79
80
|
tslib_1.__decorate([
|
|
80
81
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
82
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
81
83
|
(0, type_graphql_1.Mutation)(returns => task_1.Task, { description: 'To modify Task information' }),
|
|
82
84
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
83
85
|
tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
|
|
@@ -88,6 +90,7 @@ tslib_1.__decorate([
|
|
|
88
90
|
], TaskMutation.prototype, "updateTask", null);
|
|
89
91
|
tslib_1.__decorate([
|
|
90
92
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
93
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
91
94
|
(0, type_graphql_1.Mutation)(returns => [task_1.Task], { description: "To modify multiple Tasks' information" }),
|
|
92
95
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patches', type => [task_type_1.TaskPatch])),
|
|
93
96
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -97,6 +100,7 @@ tslib_1.__decorate([
|
|
|
97
100
|
], TaskMutation.prototype, "updateMultipleTask", null);
|
|
98
101
|
tslib_1.__decorate([
|
|
99
102
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
103
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
100
104
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete Task' }),
|
|
101
105
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
102
106
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -106,6 +110,7 @@ tslib_1.__decorate([
|
|
|
106
110
|
], TaskMutation.prototype, "deleteTask", null);
|
|
107
111
|
tslib_1.__decorate([
|
|
108
112
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
113
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
109
114
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To delete multiple Tasks' }),
|
|
110
115
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
|
|
111
116
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -115,6 +120,7 @@ tslib_1.__decorate([
|
|
|
115
120
|
], TaskMutation.prototype, "deleteTasks", null);
|
|
116
121
|
tslib_1.__decorate([
|
|
117
122
|
(0, type_graphql_1.Directive)('@transaction'),
|
|
123
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)'),
|
|
118
124
|
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To import multiple Tasks' }),
|
|
119
125
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('tasks', type => [task_type_1.TaskPatch])),
|
|
120
126
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-mutation.js","sourceRoot":"","sources":["../../../server/service/task/task-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,qEAA0F;AAE1F,iCAA6B;AAC7B,2CAAgD;AAGzC,IAAM,YAAY,GAAlB,MAAM,YAAY;
|
|
1
|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A,IAAA,kBAAG,GAAE,CAAA;;;;8CAO7C;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,0BAA0B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAUpE;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,0BAA0B,EAAE,CAAC;IACvD,mBAAA,IAAA,kBAAG,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,qBAAS,CAAC,CAAC,CAAA;IAAsB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAU9E;AA5HU,YAAY;IADxB,IAAA,uBAAQ,EAAC,WAAI,CAAC;GACF,YAAY,CA6HxB;AA7HY,oCAAY","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'\n\nimport { Task } from './task'\nimport { NewTask, TaskPatch } from './task-type'\n\n@Resolver(Task)\nexport class TaskMutation {\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Task, { description: 'To create new Task' })\n async createTask(@Arg('task') task: NewTask, @Ctx() context: ResolverContext): Promise<Task> {\n const { domain, user, tx } = context.state\n\n const result = await tx.getRepository(Task).save({\n ...task,\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 => Task, { description: 'To modify Task information' })\n async updateTask(@Arg('id') id: string, @Arg('patch') patch: TaskPatch, @Ctx() context: ResolverContext): Promise<Task> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(Task)\n const task = await repository.findOne({\n where: { id }\n })\n\n const result = await repository.save({\n ...task,\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 => [Task], { description: \"To modify multiple Tasks' information\" })\n async updateMultipleTask(\n @Arg('patches', type => [TaskPatch]) patches: TaskPatch[],\n @Ctx() context: ResolverContext\n ): Promise<Task[]> {\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 taskRepo = tx.getRepository(Task)\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 taskRepo.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 task = await taskRepo.findOneBy({ id: updateRecord.id })\n\n const result = await taskRepo.save({\n ...task,\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 Task' })\n async deleteTask(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Task).delete({ id })\n await deleteAttachmentsByRef(null, { refBys: [id] }, context)\n\n return true\n }\n\n @Directive('@transaction')\n @Directive('@privilege(category: \"project\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete multiple Tasks' })\n async deleteTasks(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(Task).delete({\n id: In(ids)\n })\n\n await deleteAttachmentsByRef(null, { refBys: ids }, context)\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 Tasks' })\n async importTasks(@Arg('tasks', type => [TaskPatch]) tasks: TaskPatch[], @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n tasks.map(async (task: TaskPatch) => {\n const createdTask: Task = await tx.getRepository(Task).save({ domain, ...task })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -2,10 +2,18 @@ import { ListParam } from '@things-factory/shell';
|
|
|
2
2
|
import { User } from '@things-factory/auth-base';
|
|
3
3
|
import { Task } from './task';
|
|
4
4
|
import { TaskList } from './task-type';
|
|
5
|
+
import { TaskResource } from '../task-resource/task-resource';
|
|
6
|
+
export declare class DigestedResource {
|
|
7
|
+
type?: string;
|
|
8
|
+
allocated?: number;
|
|
9
|
+
}
|
|
5
10
|
export declare class TaskQuery {
|
|
6
11
|
task(id: string, context: ResolverContext): Promise<Task>;
|
|
7
12
|
tasks(params: ListParam, context: ResolverContext): Promise<TaskList>;
|
|
8
|
-
|
|
13
|
+
length(task: Task): Promise<string | undefined>;
|
|
14
|
+
children(task: Task, params: ListParam, context: ResolverContext): Promise<Task[]>;
|
|
15
|
+
taskResources(task: Task): Promise<TaskResource[]>;
|
|
16
|
+
resources(task: Task): Promise<DigestedResource[]>;
|
|
9
17
|
updater(task: Task): Promise<User>;
|
|
10
18
|
creator(task: Task): Promise<User>;
|
|
11
19
|
}
|
|
@@ -1,39 +1,135 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskQuery = void 0;
|
|
3
|
+
exports.TaskQuery = exports.DigestedResource = 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
8
|
const task_1 = require("./task");
|
|
10
9
|
const task_type_1 = require("./task-type");
|
|
10
|
+
const task_resource_1 = require("../task-resource/task-resource");
|
|
11
|
+
let DigestedResource = class DigestedResource {
|
|
12
|
+
};
|
|
13
|
+
tslib_1.__decorate([
|
|
14
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '자원 유형' }),
|
|
15
|
+
tslib_1.__metadata("design:type", String)
|
|
16
|
+
], DigestedResource.prototype, "type", void 0);
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)({ nullable: true, description: '할당량' }),
|
|
19
|
+
tslib_1.__metadata("design:type", Number)
|
|
20
|
+
], DigestedResource.prototype, "allocated", void 0);
|
|
21
|
+
DigestedResource = tslib_1.__decorate([
|
|
22
|
+
(0, type_graphql_1.ObjectType)()
|
|
23
|
+
], DigestedResource);
|
|
24
|
+
exports.DigestedResource = DigestedResource;
|
|
11
25
|
let TaskQuery = class TaskQuery {
|
|
12
26
|
async task(id, context) {
|
|
13
|
-
const { domain } = context.state;
|
|
14
27
|
return await (0, shell_1.getRepository)(task_1.Task).findOne({
|
|
15
|
-
where: { id }
|
|
28
|
+
where: { id },
|
|
29
|
+
relations: ['parent', 'taskResources']
|
|
16
30
|
});
|
|
17
31
|
}
|
|
18
32
|
async tasks(params, context) {
|
|
19
|
-
const { domain } = context.state;
|
|
20
33
|
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
21
|
-
domain,
|
|
22
34
|
params,
|
|
23
35
|
repository: await (0, shell_1.getRepository)(task_1.Task),
|
|
24
|
-
|
|
36
|
+
alias: 'tasks',
|
|
37
|
+
searchables: ['name', 'code']
|
|
25
38
|
});
|
|
26
39
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
40
|
return { items, total };
|
|
28
41
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
// @FieldResolver(type => Date, { nullable: true, description: 'Calculate or return the start date of the task' })
|
|
43
|
+
// async startDate(@Root() task: Task): Promise<Date | undefined> {
|
|
44
|
+
// if (task.type === TaskType.TASK) {
|
|
45
|
+
// return task.startDate
|
|
46
|
+
// } else {
|
|
47
|
+
// const children = await getRepository(Task).find({ where: { parent: { id: task.id } } })
|
|
48
|
+
// return children.reduce(
|
|
49
|
+
// (earliest, child) => {
|
|
50
|
+
// if (!earliest || (child.startDate && child.startDate < earliest)) {
|
|
51
|
+
// return child.startDate
|
|
52
|
+
// }
|
|
53
|
+
// return earliest
|
|
54
|
+
// },
|
|
55
|
+
// undefined as Date | undefined
|
|
56
|
+
// )
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
// @FieldResolver(type => Date, { nullable: true, description: 'Calculate or return the end date of the task' })
|
|
60
|
+
// async endDate(@Root() task: Task): Promise<Date | undefined> {
|
|
61
|
+
// if (task.type === TaskType.TASK) {
|
|
62
|
+
// return task.endDate
|
|
63
|
+
// } else {
|
|
64
|
+
// const children = await getRepository(Task).find({ where: { parent: { id: task.id } } })
|
|
65
|
+
// return children.reduce(
|
|
66
|
+
// (latest, child) => {
|
|
67
|
+
// if (!latest || (child.endDate && child.endDate > latest)) {
|
|
68
|
+
// return child.endDate
|
|
69
|
+
// }
|
|
70
|
+
// return latest
|
|
71
|
+
// },
|
|
72
|
+
// undefined as Date | undefined
|
|
73
|
+
// )
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
// @FieldResolver(type => Number, { nullable: true, description: 'Calculate the duration of the task in days' })
|
|
77
|
+
// async duration(@Root() task: Task): Promise<number | undefined> {
|
|
78
|
+
// if (task.type === TaskType.TASK) {
|
|
79
|
+
// return task.duration
|
|
80
|
+
// } else {
|
|
81
|
+
// const startDate = await this.startDate(task)
|
|
82
|
+
// const endDate = await this.endDate(task)
|
|
83
|
+
// if (startDate && endDate) {
|
|
84
|
+
// const durationInMs = endDate.getTime() - startDate.getTime()
|
|
85
|
+
// const durationInDays = Math.ceil(durationInMs / (1000 * 60 * 60 * 24))
|
|
86
|
+
// return durationInDays
|
|
87
|
+
// }
|
|
88
|
+
// return
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
async length(task) {
|
|
92
|
+
// if (task.type === TaskType.TASK) {
|
|
93
|
+
return `${task.duration || 1}d`;
|
|
94
|
+
// } else {
|
|
95
|
+
// const startDate = await this.startDate(task)
|
|
96
|
+
// const endDate = await this.endDate(task)
|
|
97
|
+
// if (startDate && endDate) {
|
|
98
|
+
// const durationInMs = endDate.getTime() - startDate.getTime()
|
|
99
|
+
// const durationInDays = Math.ceil(durationInMs / (1000 * 60 * 60 * 24))
|
|
100
|
+
// return `${durationInDays || 1}d`
|
|
101
|
+
// }
|
|
102
|
+
// return
|
|
103
|
+
// }
|
|
104
|
+
}
|
|
105
|
+
async children(task, params, context) {
|
|
106
|
+
const { domain } = context.state;
|
|
107
|
+
const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
|
|
108
|
+
params,
|
|
109
|
+
alias: 'tasks',
|
|
110
|
+
repository: await (0, shell_1.getRepository)(task_1.Task),
|
|
111
|
+
searchables: ['name', 'code']
|
|
112
|
+
}).andWhere({ parent: { id: task.id } });
|
|
113
|
+
const [items, total] = await queryBuilder.getManyAndCount();
|
|
114
|
+
return items;
|
|
115
|
+
}
|
|
116
|
+
async taskResources(task) {
|
|
117
|
+
return (task === null || task === void 0 ? void 0 : task.id) && (await (0, shell_1.getRepository)(task_resource_1.TaskResource).find({ where: { task: { id: task.id } } }));
|
|
118
|
+
}
|
|
119
|
+
async resources(task) {
|
|
120
|
+
const taskResources = (task === null || task === void 0 ? void 0 : task.id) &&
|
|
121
|
+
(await (0, shell_1.getRepository)(task_resource_1.TaskResource).find({
|
|
122
|
+
where: {
|
|
123
|
+
task: { id: task.id }
|
|
124
|
+
},
|
|
125
|
+
relations: ['resource']
|
|
126
|
+
}));
|
|
127
|
+
return (taskResources || []).map(taskResource => {
|
|
128
|
+
return {
|
|
129
|
+
type: taskResource.resource.name,
|
|
130
|
+
allocated: taskResource.quantity
|
|
131
|
+
};
|
|
35
132
|
});
|
|
36
|
-
return attachment === null || attachment === void 0 ? void 0 : attachment.fullpath;
|
|
37
133
|
}
|
|
38
134
|
async updater(task) {
|
|
39
135
|
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: task.updaterId });
|
|
@@ -43,7 +139,8 @@ let TaskQuery = class TaskQuery {
|
|
|
43
139
|
}
|
|
44
140
|
};
|
|
45
141
|
tslib_1.__decorate([
|
|
46
|
-
(0, type_graphql_1.
|
|
142
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)'),
|
|
143
|
+
(0, type_graphql_1.Query)(returns => task_1.Task, { nullable: true, description: 'Fetch a single Task by its ID' }),
|
|
47
144
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
48
145
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
49
146
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -51,7 +148,8 @@ tslib_1.__decorate([
|
|
|
51
148
|
tslib_1.__metadata("design:returntype", Promise)
|
|
52
149
|
], TaskQuery.prototype, "task", null);
|
|
53
150
|
tslib_1.__decorate([
|
|
54
|
-
(0, type_graphql_1.
|
|
151
|
+
(0, type_graphql_1.Directive)('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)'),
|
|
152
|
+
(0, type_graphql_1.Query)(returns => task_type_1.TaskList, { description: 'Fetch multiple Tasks based on list parameters' }),
|
|
55
153
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
56
154
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
57
155
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -59,21 +157,45 @@ tslib_1.__decorate([
|
|
|
59
157
|
tslib_1.__metadata("design:returntype", Promise)
|
|
60
158
|
], TaskQuery.prototype, "tasks", null);
|
|
61
159
|
tslib_1.__decorate([
|
|
62
|
-
(0, type_graphql_1.FieldResolver)(type => String),
|
|
160
|
+
(0, type_graphql_1.FieldResolver)(type => String, { nullable: true, description: 'Calculate the duration of the task in days' }),
|
|
161
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
162
|
+
tslib_1.__metadata("design:type", Function),
|
|
163
|
+
tslib_1.__metadata("design:paramtypes", [task_1.Task]),
|
|
164
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
165
|
+
], TaskQuery.prototype, "length", null);
|
|
166
|
+
tslib_1.__decorate([
|
|
167
|
+
(0, type_graphql_1.FieldResolver)(type => [task_1.Task]),
|
|
168
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
169
|
+
tslib_1.__param(1, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
|
|
170
|
+
tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
|
|
171
|
+
tslib_1.__metadata("design:type", Function),
|
|
172
|
+
tslib_1.__metadata("design:paramtypes", [task_1.Task,
|
|
173
|
+
shell_1.ListParam, Object]),
|
|
174
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
175
|
+
], TaskQuery.prototype, "children", null);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
(0, type_graphql_1.FieldResolver)(type => [task_resource_1.TaskResource], { description: 'Return the list of resources allocated to the task' }),
|
|
178
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
179
|
+
tslib_1.__metadata("design:type", Function),
|
|
180
|
+
tslib_1.__metadata("design:paramtypes", [task_1.Task]),
|
|
181
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
182
|
+
], TaskQuery.prototype, "taskResources", null);
|
|
183
|
+
tslib_1.__decorate([
|
|
184
|
+
(0, type_graphql_1.FieldResolver)(type => [DigestedResource], { description: 'Return the simple list of resources allocated to the task' }),
|
|
63
185
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
64
186
|
tslib_1.__metadata("design:type", Function),
|
|
65
187
|
tslib_1.__metadata("design:paramtypes", [task_1.Task]),
|
|
66
188
|
tslib_1.__metadata("design:returntype", Promise)
|
|
67
|
-
], TaskQuery.prototype, "
|
|
189
|
+
], TaskQuery.prototype, "resources", null);
|
|
68
190
|
tslib_1.__decorate([
|
|
69
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
191
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { description: 'Fetch the user who last updated the task' }),
|
|
70
192
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
71
193
|
tslib_1.__metadata("design:type", Function),
|
|
72
194
|
tslib_1.__metadata("design:paramtypes", [task_1.Task]),
|
|
73
195
|
tslib_1.__metadata("design:returntype", Promise)
|
|
74
196
|
], TaskQuery.prototype, "updater", null);
|
|
75
197
|
tslib_1.__decorate([
|
|
76
|
-
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
|
|
198
|
+
(0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { description: 'Fetch the user who created the task' }),
|
|
77
199
|
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
78
200
|
tslib_1.__metadata("design:type", Function),
|
|
79
201
|
tslib_1.__metadata("design:paramtypes", [task_1.Task]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-query.js","sourceRoot":"","sources":["../../../server/service/task/task-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,qEAA4D;AA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from '@things-factory/attachment-base'\nimport { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Task } from './task'\nimport { TaskList } from './task-type'\n\n@Resolver(Task)\nexport class TaskQuery {\n @Query(returns => Task!, { nullable: true, description: 'To fetch a Task' })\n async task(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Task> {\n const { domain } = context.state\n\n return await getRepository(Task).findOne({\n where: { id }\n })\n }\n\n @Query(returns => TaskList, { description: 'To fetch multiple Tasks' })\n async tasks(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaskList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: await getRepository(Task),\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async thumbnail(@Root() task: Task): Promise<string | undefined> {\n const attachment: Attachment = await getRepository(Attachment).findOne({\n where: {\n refType: Task.name,\n refBy: task.id\n }\n })\n\n return attachment?.fullpath\n }\n\n @FieldResolver(type => User)\n async updater(@Root() task: Task): Promise<User> {\n return await getRepository(User).findOneBy({ id: task.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() task: Task): Promise<User> {\n return await getRepository(User).findOneBy({ id: task.creatorId })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-query.js","sourceRoot":"","sources":["../../../server/service/task/task-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAiH;AACjH,iDAAuG;AACvG,yDAAgD;AAChD,iCAAuC;AACvC,2CAAsC;AACtC,kEAA6D;AAItD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;;8CACnC;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAA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W,EAAE,0CAA0C,EAAE,CAAC;IAC1E,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAO,WAAI;;wCAE/B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IACrE,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAO,WAAI;;wCAE/B;AArJU,SAAS;IADrB,IAAA,uBAAQ,EAAC,WAAI,CAAC;GACF,SAAS,CAsJrB;AAtJY,8BAAS","sourcesContent":["import { Resolver, Query, Field, FieldResolver, ObjectType, 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 { Task, TaskType } from './task'\nimport { TaskList } from './task-type'\nimport { TaskResource } from '../task-resource/task-resource'\nimport { ResourceType } from 'service/resource/resource'\n\n@ObjectType()\nexport class DigestedResource {\n @Field({ nullable: true, description: '자원 유형' })\n type?: string\n\n @Field({ nullable: true, description: '할당량' })\n allocated?: number\n}\n\n@Resolver(Task)\nexport class TaskQuery {\n @Directive('@privilege(category: \"project\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => Task!, { nullable: true, description: 'Fetch a single Task by its ID' })\n async task(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Task> {\n return await getRepository(Task).findOne({\n where: { id },\n relations: ['parent', 'taskResources']\n })\n }\n\n @Directive('@privilege(category: \"project\", privilege: \"query\", domainOwnerGranted: true)')\n @Query(returns => TaskList, { description: 'Fetch multiple Tasks based on list parameters' })\n async tasks(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaskList> {\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(Task),\n alias: 'tasks',\n searchables: ['name', 'code']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n // @FieldResolver(type => Date, { nullable: true, description: 'Calculate or return the start date of the task' })\n // async startDate(@Root() task: Task): Promise<Date | undefined> {\n // if (task.type === TaskType.TASK) {\n // return task.startDate\n // } else {\n // const children = await getRepository(Task).find({ where: { parent: { id: task.id } } })\n // return children.reduce(\n // (earliest, child) => {\n // if (!earliest || (child.startDate && child.startDate < earliest)) {\n // return child.startDate\n // }\n // return earliest\n // },\n // undefined as Date | undefined\n // )\n // }\n // }\n\n // @FieldResolver(type => Date, { nullable: true, description: 'Calculate or return the end date of the task' })\n // async endDate(@Root() task: Task): Promise<Date | undefined> {\n // if (task.type === TaskType.TASK) {\n // return task.endDate\n // } else {\n // const children = await getRepository(Task).find({ where: { parent: { id: task.id } } })\n // return children.reduce(\n // (latest, child) => {\n // if (!latest || (child.endDate && child.endDate > latest)) {\n // return child.endDate\n // }\n // return latest\n // },\n // undefined as Date | undefined\n // )\n // }\n // }\n\n // @FieldResolver(type => Number, { nullable: true, description: 'Calculate the duration of the task in days' })\n // async duration(@Root() task: Task): Promise<number | undefined> {\n // if (task.type === TaskType.TASK) {\n // return task.duration\n // } else {\n // const startDate = await this.startDate(task)\n // const endDate = await this.endDate(task)\n\n // if (startDate && endDate) {\n // const durationInMs = endDate.getTime() - startDate.getTime()\n // const durationInDays = Math.ceil(durationInMs / (1000 * 60 * 60 * 24))\n // return durationInDays\n // }\n\n // return\n // }\n // }\n\n @FieldResolver(type => String, { nullable: true, description: 'Calculate the duration of the task in days' })\n async length(@Root() task: Task): Promise<string | undefined> {\n // if (task.type === TaskType.TASK) {\n return `${task.duration || 1}d`\n // } else {\n // const startDate = await this.startDate(task)\n // const endDate = await this.endDate(task)\n\n // if (startDate && endDate) {\n // const durationInMs = endDate.getTime() - startDate.getTime()\n // const durationInDays = Math.ceil(durationInMs / (1000 * 60 * 60 * 24))\n // return `${durationInDays || 1}d`\n // }\n\n // return\n // }\n }\n\n @FieldResolver(type => [Task])\n async children(\n @Root() task: Task,\n @Args(type => ListParam) params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<Task[]> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n alias: 'tasks',\n repository: await getRepository(Task),\n searchables: ['name', 'code']\n }).andWhere({ parent: { id: task.id } })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return items\n }\n\n @FieldResolver(type => [TaskResource], { description: 'Return the list of resources allocated to the task' })\n async taskResources(@Root() task: Task): Promise<TaskResource[]> {\n return task?.id && (await getRepository(TaskResource).find({ where: { task: { id: task.id } } }))\n }\n\n @FieldResolver(type => [DigestedResource], { description: 'Return the simple list of resources allocated to the task' })\n async resources(@Root() task: Task): Promise<DigestedResource[]> {\n const taskResources =\n task?.id &&\n (await getRepository(TaskResource).find({\n where: {\n task: { id: task.id }\n },\n relations: ['resource']\n }))\n\n return (taskResources || []).map(taskResource => {\n return {\n type: taskResource.resource.name,\n allocated: taskResource.quantity\n }\n })\n }\n\n @FieldResolver(type => User, { description: 'Fetch the user who last updated the task' })\n async updater(@Root() task: Task): Promise<User> {\n return await getRepository(User).findOneBy({ id: task.updaterId })\n }\n\n @FieldResolver(type => User, { description: 'Fetch the user who created the task' })\n async creator(@Root() task: Task): Promise<User> {\n return await getRepository(User).findOneBy({ id: task.creatorId })\n }\n}\n"]}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
import { ObjectRef } from '@things-factory/shell';
|
|
1
2
|
import { Task } from './task';
|
|
3
|
+
export declare class ObjectRefForProject extends ObjectRef {
|
|
4
|
+
name?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ObjectRefForTask extends ObjectRef {
|
|
7
|
+
code?: string;
|
|
8
|
+
}
|
|
2
9
|
export declare class NewTask {
|
|
10
|
+
code: string;
|
|
3
11
|
name: string;
|
|
12
|
+
project?: ObjectRefForProject;
|
|
13
|
+
parent?: ObjectRefForTask;
|
|
4
14
|
description?: string;
|
|
5
15
|
active?: boolean;
|
|
6
16
|
params?: string;
|
|
7
17
|
}
|
|
8
18
|
export declare class TaskPatch {
|
|
9
19
|
id?: string;
|
|
20
|
+
code?: string;
|
|
10
21
|
name?: string;
|
|
22
|
+
project?: ObjectRefForProject;
|
|
23
|
+
parent?: ObjectRefForTask;
|
|
11
24
|
description?: string;
|
|
12
25
|
active?: boolean;
|
|
13
26
|
cuFlag?: string;
|