@dssp/supervision 1.0.0-alpha.4 → 1.0.0-alpha.40
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/dist-client/graphql/building-inspection.d.ts +1 -0
- package/dist-client/graphql/building-inspection.js +100 -0
- package/dist-client/graphql/building-inspection.js.map +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +9 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +130 -72
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.d.ts +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +77 -14
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-list.d.ts +18 -2
- package/dist-client/pages/building-inspection/building-inspection-list.js +360 -28
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js +31 -9
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -1
- package/dist-client/pages/building-inspection/component/daily-worklog-popup.d.ts +27 -0
- package/dist-client/pages/building-inspection/component/daily-worklog-popup.js +542 -0
- package/dist-client/pages/building-inspection/component/daily-worklog-popup.js.map +1 -0
- package/dist-client/pages/building-inspection/component/image-preview-popup.d.ts +15 -0
- package/dist-client/pages/building-inspection/component/image-preview-popup.js +351 -0
- package/dist-client/pages/building-inspection/component/image-preview-popup.js.map +1 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-request-document.d.ts +20 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-request-document.js +432 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-request-document.js.map +1 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-result-notification.d.ts +30 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-result-notification.js +479 -0
- package/dist-client/pages/building-inspection/component/inspection-document/inspection-result-notification.js.map +1 -0
- package/dist-client/pages/building-inspection/component/inspection-document/photo-album-popup.d.ts +27 -0
- package/dist-client/pages/building-inspection/component/inspection-document/photo-album-popup.js +401 -0
- package/dist-client/pages/building-inspection/component/inspection-document/photo-album-popup.js.map +1 -0
- package/dist-client/pages/building-inspection/component/inspection-event-provider.d.ts +2 -1
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js +39 -17
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js.map +1 -1
- package/dist-client/pages/building-inspection/inspection-create-popup.js +22 -9
- package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -1
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.d.ts +60 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js +1132 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.d.ts +2 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.js +740 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-create-popup.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-list-layer.d.ts +19 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-list-layer.js +205 -0
- package/dist-client/pages/building-inspection-grid/component/grid-inspection-list-layer.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.d.ts +1 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js +304 -0
- package/dist-client/pages/building-inspection-grid/component/notice-comment-popup.js.map +1 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.d.ts +15 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.js +430 -0
- package/dist-client/pages/building-inspection-grid/component/plan-preview-popup.js.map +1 -0
- package/dist-client/pages/checklist/attachment-list-popup.d.ts +1 -0
- package/dist-client/pages/checklist/attachment-list-popup.js +250 -67
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/checklist-view.d.ts +7 -0
- package/dist-client/pages/checklist/checklist-view.js +363 -185
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- package/dist-client/pages/checklist/comment-list-popup.js +14 -3
- package/dist-client/pages/checklist/comment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/file-preview-popup.js +0 -1
- package/dist-client/pages/checklist/file-preview-popup.js.map +1 -1
- package/dist-client/pages/checklist/inspection-info-popup.d.ts +50 -0
- package/dist-client/pages/checklist/inspection-info-popup.js +684 -0
- package/dist-client/pages/checklist/inspection-info-popup.js.map +1 -0
- package/dist-client/pages/checklist/inspection-tab-popup.d.ts +18 -0
- package/dist-client/pages/checklist/inspection-tab-popup.js +196 -0
- package/dist-client/pages/checklist/inspection-tab-popup.js.map +1 -0
- package/dist-client/pages/checklist-template/checklist-template-item.js +8 -3
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-template-list.js +2 -2
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +3 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/stt/speech-to-text.d.ts +36 -0
- package/dist-client/stt/speech-to-text.js +89 -0
- package/dist-client/stt/speech-to-text.js.map +1 -0
- package/dist-client/stt/stt-utils.d.ts +28 -0
- package/dist-client/stt/stt-utils.js +146 -0
- package/dist-client/stt/stt-utils.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/action-plan/index.d.ts +0 -1
- package/dist-server/service/action-plan/index.js +1 -2
- package/dist-server/service/action-plan/index.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.d.ts +1 -0
- package/dist-server/service/building-inspection/building-inspection-history.js +5 -0
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +3 -3
- package/dist-server/service/building-inspection/building-inspection-mutation.js +145 -34
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +3 -4
- package/dist-server/service/building-inspection/building-inspection-query.js +46 -30
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +28 -9
- package/dist-server/service/building-inspection/building-inspection-type.js +96 -17
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection.d.ts +13 -0
- package/dist-server/service/building-inspection/building-inspection.js +55 -2
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
- package/dist-server/service/building-inspection/index.d.ts +5 -8
- package/dist-server/service/building-inspection/index.js +11 -6
- package/dist-server/service/building-inspection/index.js.map +1 -1
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-mutation.d.ts +6 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-mutation.js +56 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-mutation.js.map +1 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-query.d.ts +16 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-query.js +171 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-query.js.map +1 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-type.d.ts +23 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-type.js +90 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog-type.js.map +1 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog.d.ts +33 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog.js +132 -0
- package/dist-server/service/building-inspection-daily-worklog/building-inspection-daily-worklog.js.map +1 -0
- package/dist-server/service/building-inspection-daily-worklog/index.d.ts +5 -0
- package/dist-server/service/building-inspection-daily-worklog/index.js +9 -0
- package/dist-server/service/building-inspection-daily-worklog/index.js.map +1 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-query.d.ts +16 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-query.js +120 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-query.js.map +1 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-type.d.ts +5 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-type.js +21 -0
- package/dist-server/service/building-inspection-history/building-inspection-history-type.js.map +1 -0
- package/dist-server/service/building-inspection-history/building-inspection-history.d.ts +34 -0
- package/dist-server/service/building-inspection-history/building-inspection-history.js +157 -0
- package/dist-server/service/building-inspection-history/building-inspection-history.js.map +1 -0
- package/dist-server/service/{building-inspection → building-inspection-history}/event-subscriber.d.ts +1 -1
- package/dist-server/service/{building-inspection → building-inspection-history}/event-subscriber.js +1 -1
- package/dist-server/service/building-inspection-history/event-subscriber.js.map +1 -0
- package/dist-server/service/building-inspection-history/index.d.ts +6 -0
- package/dist-server/service/building-inspection-history/index.js +10 -0
- package/dist-server/service/building-inspection-history/index.js.map +1 -0
- package/dist-server/service/checklist/checklist-history.d.ts +8 -0
- package/dist-server/service/checklist/checklist-history.js +36 -0
- package/dist-server/service/checklist/checklist-history.js.map +1 -1
- package/dist-server/service/checklist/checklist-mutation.d.ts +0 -5
- package/dist-server/service/checklist/checklist-mutation.js +1 -67
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -1
- package/dist-server/service/checklist/checklist-query.d.ts +6 -0
- package/dist-server/service/checklist/checklist-query.js +63 -0
- package/dist-server/service/checklist/checklist-query.js.map +1 -1
- package/dist-server/service/checklist/checklist-type.d.ts +0 -13
- package/dist-server/service/checklist/checklist-type.js +1 -49
- package/dist-server/service/checklist/checklist-type.js.map +1 -1
- package/dist-server/service/checklist/checklist.d.ts +38 -3
- package/dist-server/service/checklist/checklist.js +131 -15
- package/dist-server/service/checklist/checklist.js.map +1 -1
- package/dist-server/service/checklist/event-subscriber.d.ts +2 -2
- package/dist-server/service/checklist/event-subscriber.js +2 -2
- package/dist-server/service/checklist/event-subscriber.js.map +1 -1
- package/dist-server/service/checklist/index.d.ts +1 -4
- package/dist-server/service/checklist/index.js +2 -5
- package/dist-server/service/checklist/index.js.map +1 -1
- package/dist-server/service/checklist-history/checklist-history-query.d.ts +11 -0
- package/dist-server/service/checklist-history/checklist-history-query.js +77 -0
- package/dist-server/service/checklist-history/checklist-history-query.js.map +1 -0
- package/dist-server/service/checklist-history/checklist-history-type.d.ts +5 -0
- package/dist-server/service/checklist-history/checklist-history-type.js +21 -0
- package/dist-server/service/checklist-history/checklist-history-type.js.map +1 -0
- package/dist-server/service/checklist-history/checklist-history.d.ts +50 -0
- package/dist-server/service/checklist-history/checklist-history.js +239 -0
- package/dist-server/service/checklist-history/checklist-history.js.map +1 -0
- package/dist-server/service/checklist-history/event-subscriber.d.ts +7 -0
- package/dist-server/service/checklist-history/event-subscriber.js +21 -0
- package/dist-server/service/checklist-history/event-subscriber.js.map +1 -0
- package/dist-server/service/checklist-history/index.d.ts +6 -0
- package/dist-server/service/checklist-history/index.js +10 -0
- package/dist-server/service/checklist-history/index.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-query.d.ts +1 -1
- package/dist-server/service/checklist-item/checklist-item-query.js +5 -3
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -1
- package/dist-server/service/checklist-item/index.d.ts +0 -1
- package/dist-server/service/checklist-item/index.js +1 -2
- package/dist-server/service/checklist-item/index.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.d.ts +1 -0
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js +33 -6
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js.map +1 -1
- package/dist-server/service/checklist-item-comment/index.d.ts +0 -2
- package/dist-server/service/checklist-item-comment/index.js +1 -3
- package/dist-server/service/checklist-item-comment/index.js.map +1 -1
- package/dist-server/service/checklist-item-history/checklist-item-history-query.d.ts +16 -0
- package/dist-server/service/checklist-item-history/checklist-item-history-query.js +123 -0
- package/dist-server/service/checklist-item-history/checklist-item-history-query.js.map +1 -0
- package/dist-server/service/checklist-item-history/checklist-item-history-type.d.ts +5 -0
- package/dist-server/service/checklist-item-history/checklist-item-history-type.js +21 -0
- package/dist-server/service/checklist-item-history/checklist-item-history-type.js.map +1 -0
- package/dist-server/service/checklist-item-history/checklist-item-history.d.ts +25 -0
- package/dist-server/service/checklist-item-history/checklist-item-history.js +123 -0
- package/dist-server/service/checklist-item-history/checklist-item-history.js.map +1 -0
- package/dist-server/service/checklist-item-history/event-subscriber.d.ts +7 -0
- package/dist-server/service/checklist-item-history/event-subscriber.js +21 -0
- package/dist-server/service/checklist-item-history/event-subscriber.js.map +1 -0
- package/dist-server/service/checklist-item-history/index.d.ts +6 -0
- package/dist-server/service/checklist-item-history/index.js +10 -0
- package/dist-server/service/checklist-item-history/index.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js +2 -4
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -1
- package/dist-server/service/index.d.ts +4 -2
- package/dist-server/service/index.js +22 -13
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/issue/index.d.ts +0 -1
- package/dist-server/service/issue/index.js +1 -2
- package/dist-server/service/issue/index.js.map +1 -1
- package/dist-server/service/project-report/index.d.ts +0 -1
- package/dist-server/service/project-report/index.js +1 -2
- package/dist-server/service/project-report/index.js.map +1 -1
- package/dist-server/service/project-report/project-report.d.ts +0 -2
- package/dist-server/service/project-report/project-report.js +0 -6
- package/dist-server/service/project-report/project-report.js.map +1 -1
- package/dist-server/service/supervisor/index.d.ts +0 -1
- package/dist-server/service/supervisor/index.js +1 -2
- package/dist-server/service/supervisor/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/things-factory.config.js +3 -1
- package/dist-server/service/building-inspection/event-subscriber.js.map +0 -1
- package/dist-server/service/checklist-item-comment/event-subscriber.d.ts +0 -7
- package/dist-server/service/checklist-item-comment/event-subscriber.js +0 -21
- package/dist-server/service/checklist-item-comment/event-subscriber.js.map +0 -1
|
@@ -3,4 +3,3 @@ import { ActionPlanQuery } from './action-plan-query';
|
|
|
3
3
|
import { ActionPlanMutation } from './action-plan-mutation';
|
|
4
4
|
export declare const entities: (typeof ActionPlan)[];
|
|
5
5
|
export declare const resolvers: (typeof ActionPlanQuery | typeof ActionPlanMutation)[];
|
|
6
|
-
export declare const subscribers: any[];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.resolvers = exports.entities = void 0;
|
|
4
4
|
const action_plan_1 = require("./action-plan");
|
|
5
5
|
const action_plan_query_1 = require("./action-plan-query");
|
|
6
6
|
const action_plan_mutation_1 = require("./action-plan-mutation");
|
|
7
7
|
exports.entities = [action_plan_1.ActionPlan];
|
|
8
8
|
exports.resolvers = [action_plan_query_1.ActionPlanQuery, action_plan_mutation_1.ActionPlanMutation];
|
|
9
|
-
exports.subscribers = [];
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/action-plan/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,2DAAqD;AACrD,iEAA2D;AAE9C,QAAA,QAAQ,GAAG,CAAC,wBAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,mCAAe,EAAE,yCAAkB,CAAC,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/action-plan/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,2DAAqD;AACrD,iEAA2D;AAE9C,QAAA,QAAQ,GAAG,CAAC,wBAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,mCAAe,EAAE,yCAAkB,CAAC,CAAA","sourcesContent":["import { ActionPlan } from './action-plan'\nimport { ActionPlanQuery } from './action-plan-query'\nimport { ActionPlanMutation } from './action-plan-mutation'\n\nexport const entities = [ActionPlan]\nexport const resolvers = [ActionPlanQuery, ActionPlanMutation]\n"]}
|
|
@@ -45,6 +45,11 @@ tslib_1.__decorate([
|
|
|
45
45
|
(0, type_graphql_1.Field)(type => String, { nullable: true }),
|
|
46
46
|
tslib_1.__metadata("design:type", String)
|
|
47
47
|
], BuildingInspectionHistory.prototype, "requestDate", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ nullable: true, comment: '메모' }),
|
|
50
|
+
(0, type_graphql_1.Field)({ nullable: true }),
|
|
51
|
+
tslib_1.__metadata("design:type", String)
|
|
52
|
+
], BuildingInspectionHistory.prototype, "memo", void 0);
|
|
48
53
|
tslib_1.__decorate([
|
|
49
54
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
50
55
|
(0, typeorm_1.Column)({ nullable: true, comment: '체크리스트 ID' }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"building-inspection-history.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAC9F,8DAAkI;AAClI,yDAAgD;AAChD,6CAA4C;AAC5C,+DAAoF;AACpF,6DAAsD;AAEtD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAO7B,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;
|
|
1
|
+
{"version":3,"file":"building-inspection-history.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-history.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAA8F;AAC9F,8DAAkI;A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, PrimaryGeneratedColumn, RelationId } from 'typeorm'\nimport { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'\nimport { User } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { BuildingInspection, BuildingInspectionStatus } from './building-inspection'\nimport { BuildingLevel } from '@dssp/building-complex'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\n@Entity()\n@Index('ix_buildingInspection_history_0', (buildingInspectionHistory: BuildingInspectionHistory) => [\n buildingInspectionHistory.originalId\n])\n@ObjectType({ description: 'History Entity of BuildingInspection' })\nexport class BuildingInspectionHistory implements HistoryEntityInterface<BuildingInspection> {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @HistoryOriginalIdColumn()\n public originalId!: string\n\n @Column({\n nullable: false,\n comment:\n '상태(WAIT: 검측 대기, OVERALL_WAIT: 총괄자 검측 대기, REQUEST: 검측 요청, OVERALL_REQUEST: 총괄자 검측 요청, PASS: 합격, FAIL: 불합격)'\n })\n @Field({ nullable: true })\n status?: BuildingInspectionStatus\n\n // 층 정보 (1:1 테이블 참조)\n @ManyToOne(type => BuildingLevel)\n @Field({ nullable: true })\n buildingLevel?: BuildingLevel\n\n @RelationId((buildingInspectionHistory: BuildingInspectionHistory) => buildingInspectionHistory.buildingLevel)\n buildingLevelId?: string\n\n @Column({ type: 'date', nullable: true, comment: '검측 요청일' })\n @Field(type => String, { nullable: true })\n requestDate?: string\n\n @Column({ nullable: true, comment: '메모' })\n @Field({ nullable: true })\n memo?: string\n\n // 체크리스트 ID (1:1 테이블 참조)\n @Field({ nullable: true })\n @Column({ nullable: true, comment: '체크리스트 ID' })\n checklistId: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n createdAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((buildingInspectionHistory: BuildingInspectionHistory) => buildingInspectionHistory.creator)\n creatorId?: string\n\n @HistoryActionColumn({\n nullable: false,\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : 'smallint',\n enum: HistoryActionType\n })\n public action!: HistoryActionType\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BuildingInspection } from './building-inspection';
|
|
2
|
-
import { NewBuildingInspection,
|
|
2
|
+
import { NewBuildingInspection, UpdateBuildingInspection, UpdateBuildingInspectionSubmitType } from './building-inspection-type';
|
|
3
3
|
export declare class BuildingInspectionMutation {
|
|
4
4
|
createBuildingInspection(patch: NewBuildingInspection, context: ResolverContext): Promise<BuildingInspection>;
|
|
5
5
|
updateBuildingInspectionChecklist(buildingInspection: UpdateBuildingInspectionSubmitType, context: ResolverContext): Promise<boolean>;
|
|
6
|
-
updateBuildingInspection(patch:
|
|
6
|
+
updateBuildingInspection(patch: UpdateBuildingInspection, context: ResolverContext): Promise<BuildingInspection>;
|
|
7
7
|
deleteBuildingInspections(ids: string[], context: ResolverContext): Promise<boolean>;
|
|
8
|
-
|
|
8
|
+
applyToAllBuildingInspection(buildingInspectionId: string, context: ResolverContext): Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -11,33 +11,51 @@ const checklist_1 = require("../checklist/checklist");
|
|
|
11
11
|
const checklist_item_1 = require("../checklist-item/checklist-item");
|
|
12
12
|
const shell_1 = require("@things-factory/shell");
|
|
13
13
|
const building_complex_1 = require("@dssp/building-complex");
|
|
14
|
+
const env_1 = require("@things-factory/env");
|
|
15
|
+
const checklist_2 = require("../checklist/checklist");
|
|
16
|
+
const projectType = env_1.config.get('projectType', building_inspection_1.ProjectType.DSSP);
|
|
14
17
|
let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
15
18
|
async createBuildingInspection(patch, context) {
|
|
16
19
|
const { user, tx } = context.state;
|
|
17
|
-
const { buildingLevelId, checklist, checklistItem } = patch;
|
|
20
|
+
const { buildingLevelId, checklist, checklistItem, cellX, cellY, managerId } = patch;
|
|
18
21
|
const buildingInspectionRepository = tx.getRepository(building_inspection_1.BuildingInspection);
|
|
19
22
|
const checklistRepository = tx.getRepository(checklist_1.Checklist);
|
|
20
23
|
const checklistItemRepository = tx.getRepository(checklist_item_1.ChecklistItem);
|
|
21
24
|
// 1. 벨리데이션
|
|
22
|
-
if (!buildingLevelId)
|
|
23
|
-
throw new Error('층 아이디가 없습니다.');
|
|
24
|
-
if (!checklist.name)
|
|
25
|
-
throw new Error('체크리스트 이름이 없습니다.');
|
|
26
25
|
if (!checklist.constructionType)
|
|
27
26
|
throw new Error('공종 타입이 없습니다.');
|
|
28
27
|
if (!checklist.constructionDetailType)
|
|
29
28
|
throw new Error('상세 공종 타입이 없습니다.');
|
|
30
|
-
if (!checklist.
|
|
31
|
-
throw new Error('
|
|
32
|
-
if (!checklist.inspectionDrawingType)
|
|
33
|
-
throw new Error('검측 도면 타입이 없습니다.');
|
|
34
|
-
if (checklist.inspectionParts.length === 0)
|
|
35
|
-
throw new Error('검측 부위가 없습니다.');
|
|
29
|
+
if (!checklist.name)
|
|
30
|
+
throw new Error('체크리스트 이름이 없습니다.');
|
|
36
31
|
if (checklistItem.length === 0)
|
|
37
32
|
throw new Error('체크리스트 아이템이 없습니다.');
|
|
33
|
+
if (projectType === building_inspection_1.ProjectType.DSSP) {
|
|
34
|
+
if (!cellX || !cellY)
|
|
35
|
+
throw new Error('셀 좌표가 없습니다.');
|
|
36
|
+
if (!managerId)
|
|
37
|
+
throw new Error('담당자가 없습니다.');
|
|
38
|
+
if (!buildingLevelId)
|
|
39
|
+
throw new Error('층 아이디가 없습니다.');
|
|
40
|
+
if (!checklist.location)
|
|
41
|
+
throw new Error('위치가 없습니다.');
|
|
42
|
+
}
|
|
43
|
+
else if (projectType === building_inspection_1.ProjectType.DCSP) {
|
|
44
|
+
if (!checklist.inspectionDrawingType)
|
|
45
|
+
throw new Error('검측 도면 타입이 없습니다.');
|
|
46
|
+
if (checklist.inspectionParts.length === 0)
|
|
47
|
+
throw new Error('검측 부위가 없습니다.');
|
|
48
|
+
if (!buildingLevelId)
|
|
49
|
+
throw new Error('층 아이디가 없습니다.');
|
|
50
|
+
if (!checklist.location)
|
|
51
|
+
throw new Error('위치가 없습니다.');
|
|
52
|
+
}
|
|
38
53
|
// 2. checklist 저장
|
|
39
|
-
const
|
|
40
|
-
const
|
|
54
|
+
const checklistDocumentNo = await getRecentDocumentNoByBuildingLevelId(buildingLevelId, checklist_1.DocumentNoType.CHECKLIST, tx);
|
|
55
|
+
const inspectionRequestDocumentNo = checklistDocumentNo.replace(`검측 제${checklist_1.DocumentNoType.CHECKLIST}-`, `검측 제${checklist_1.DocumentNoType.INSPECTION_REQUEST}-`);
|
|
56
|
+
const inspectionResultDocumentNo = checklistDocumentNo.replace(`검측 제${checklist_1.DocumentNoType.CHECKLIST}-`, `검측 제${checklist_1.DocumentNoType.INSPECTION_RESULT}-`);
|
|
57
|
+
const savedChecklist = await checklistRepository.save(Object.assign(Object.assign({}, checklist), { projectType, checklistReferenceType: checklist_2.ChecklistReferenceType.INSPECTION, documentNo: checklistDocumentNo, inspectionRequestDocumentNo,
|
|
58
|
+
inspectionResultDocumentNo, creator: user, updater: user }));
|
|
41
59
|
// 3. checklistItem 저장
|
|
42
60
|
const checklistItems = checklistItem.map((item, idx) => ({
|
|
43
61
|
name: item.name,
|
|
@@ -55,6 +73,10 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
55
73
|
status: building_inspection_2.BuildingInspectionStatus.WAIT,
|
|
56
74
|
buildingLevel: { id: buildingLevelId },
|
|
57
75
|
checklist: savedChecklist,
|
|
76
|
+
projectType,
|
|
77
|
+
manager: managerId ? { id: managerId } : null,
|
|
78
|
+
cellX,
|
|
79
|
+
cellY,
|
|
58
80
|
creator: user,
|
|
59
81
|
updater: user
|
|
60
82
|
});
|
|
@@ -63,7 +85,7 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
63
85
|
// 검측 상태 변경 & 체크리스트 갱신
|
|
64
86
|
async updateBuildingInspectionChecklist(buildingInspection, context) {
|
|
65
87
|
const { user, tx } = context.state;
|
|
66
|
-
const { id: buildingInspectionId, checklist, checklistItem } = buildingInspection;
|
|
88
|
+
const { id: buildingInspectionId, memo, checklist, checklistItem } = buildingInspection;
|
|
67
89
|
const buildingInspectionRepo = tx.getRepository(building_inspection_1.BuildingInspection);
|
|
68
90
|
const checklistRepo = tx.getRepository(checklist_1.Checklist);
|
|
69
91
|
const checklistItemRepo = tx.getRepository(checklist_item_1.ChecklistItem);
|
|
@@ -73,6 +95,9 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
73
95
|
status == building_inspection_2.BuildingInspectionStatus.OVERALL_WAIT ||
|
|
74
96
|
status == building_inspection_2.BuildingInspectionStatus.FAIL;
|
|
75
97
|
let inspectionStatus = null;
|
|
98
|
+
let signedUserType = null; // 싸인을 한 유저 타입
|
|
99
|
+
let inspectionRequestData = {};
|
|
100
|
+
let inspectionResultData = {};
|
|
76
101
|
// 1. 벨리데이션
|
|
77
102
|
if (!buildingInspectionId)
|
|
78
103
|
throw new Error('검측 아이디가 없습니다.');
|
|
@@ -102,12 +127,18 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
102
127
|
else if (isPassed && (status === building_inspection_2.BuildingInspectionStatus.WAIT || status === building_inspection_2.BuildingInspectionStatus.FAIL)) {
|
|
103
128
|
// 2. 검측이 합격이면서 공종 시공자 스탭 = 상태는 총괄 시공자 스탭으로
|
|
104
129
|
inspectionStatus = building_inspection_2.BuildingInspectionStatus.OVERALL_WAIT;
|
|
130
|
+
signedUserType = 'taskConstructor';
|
|
105
131
|
}
|
|
106
132
|
else if (isPassed && status === building_inspection_2.BuildingInspectionStatus.OVERALL_WAIT) {
|
|
107
133
|
// 3. 검측이 합격이면서 총괄 시공자 스탭 = 상태는 공종 감리자 스탭으로, 감리자 싸인은 모두 초기화
|
|
108
134
|
inspectionStatus = building_inspection_2.BuildingInspectionStatus.REQUEST;
|
|
109
135
|
checklist.overallSupervisorySignature = null;
|
|
110
136
|
checklist.taskSupervisorySignature = null;
|
|
137
|
+
signedUserType = 'overallConstructor';
|
|
138
|
+
inspectionRequestData = {
|
|
139
|
+
inspectionRequestMemo: checklist.inspectionRequestMemo,
|
|
140
|
+
inspectionRequestUpdatedAt: new Date()
|
|
141
|
+
};
|
|
111
142
|
}
|
|
112
143
|
}
|
|
113
144
|
else {
|
|
@@ -132,18 +163,27 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
132
163
|
else if (isPassed && status === building_inspection_2.BuildingInspectionStatus.REQUEST) {
|
|
133
164
|
// 2. 검측이 합격이면서 공종 감리자 스탭 = 상태는 총괄 감리자 스탭으로
|
|
134
165
|
inspectionStatus = building_inspection_2.BuildingInspectionStatus.OVERALL_REQUEST;
|
|
166
|
+
signedUserType = 'taskSupervisory';
|
|
135
167
|
}
|
|
136
168
|
else if (isPassed && status === building_inspection_2.BuildingInspectionStatus.OVERALL_REQUEST) {
|
|
137
169
|
// 3. 검측이 합격이면서 총괄 감리자 스탭 = 상태는 합격으로
|
|
138
170
|
inspectionStatus = building_inspection_2.BuildingInspectionStatus.PASS;
|
|
171
|
+
signedUserType = 'overallSupervisory';
|
|
172
|
+
inspectionResultData = {
|
|
173
|
+
inspectionResultStatus: checklist.inspectionResultStatus,
|
|
174
|
+
inspectionResultMemo: checklist.inspectionResultMemo,
|
|
175
|
+
inspectionResultType: checklist.inspectionResultType,
|
|
176
|
+
inspectionResultUpdatedAt: new Date()
|
|
177
|
+
};
|
|
139
178
|
}
|
|
140
179
|
}
|
|
141
180
|
// 2. buildingInspection 저장
|
|
142
|
-
await buildingInspectionRepo.save(Object.assign(Object.assign({}, oldBuildingInspection), { status: inspectionStatus, updater: user }));
|
|
181
|
+
await buildingInspectionRepo.save(Object.assign(Object.assign({}, oldBuildingInspection), { status: inspectionStatus, memo: memo, updater: user }));
|
|
143
182
|
// 3. checklist 저장
|
|
144
183
|
const oldChecklist = await checklistRepo.findOneBy({ id: checklist.id });
|
|
145
184
|
const inspectionDateField = isConstructor ? 'constructionInspectionDate' : 'supervisorInspectionDate';
|
|
146
|
-
|
|
185
|
+
const signedUser = signedUserType ? { [signedUserType]: user } : {};
|
|
186
|
+
await checklistRepo.save(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, oldChecklist), { [inspectionDateField]: new Date(), overallConstructorSignature: checklist.overallConstructorSignature, taskConstructorSignature: checklist.taskConstructorSignature, overallSupervisorySignature: checklist.overallSupervisorySignature, taskSupervisorySignature: checklist.taskSupervisorySignature }), signedUser), inspectionRequestData), inspectionResultData), { updater: user }));
|
|
147
187
|
// 4. checklistItem 저장
|
|
148
188
|
for (let item of checklistItem) {
|
|
149
189
|
const confirmStatusField = isConstructor ? 'constructionConfirmStatus' : 'supervisoryConfirmStatus';
|
|
@@ -195,25 +235,54 @@ let BuildingInspectionMutation = class BuildingInspectionMutation {
|
|
|
195
235
|
.execute();
|
|
196
236
|
return true;
|
|
197
237
|
}
|
|
198
|
-
async
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
238
|
+
async applyToAllBuildingInspection(buildingInspectionId, context) {
|
|
239
|
+
const { user, tx } = context.state;
|
|
240
|
+
const buildingInspectionRepository = tx.getRepository(building_inspection_1.BuildingInspection);
|
|
241
|
+
const buildingInspection = await buildingInspectionRepository.findOne({
|
|
242
|
+
where: { id: buildingInspectionId },
|
|
243
|
+
relations: ['buildingLevel', 'buildingLevel.building', 'checklist', 'checklist.checklistItems']
|
|
244
|
+
});
|
|
245
|
+
const checklist = buildingInspection.checklist;
|
|
246
|
+
const checklistItems = checklist.checklistItems;
|
|
247
|
+
const buildingLevels = await (0, shell_1.getRepository)(building_complex_1.BuildingLevel).find({
|
|
248
|
+
where: { building: { id: buildingInspection.buildingLevel.building.id } }
|
|
203
249
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
250
|
+
// 해당 검측 정보가 속한 동의 모든 층에 같은 검측 데이터 등록
|
|
251
|
+
for (let buildingLevel of buildingLevels) {
|
|
252
|
+
// 같은 셀에 이미 검측 정보가 있으면 패스
|
|
253
|
+
const existInspection = await buildingInspectionRepository.findOneBy({
|
|
254
|
+
buildingLevel: { id: buildingLevel.id },
|
|
255
|
+
cellX: buildingInspection.cellX,
|
|
256
|
+
cellY: buildingInspection.cellY
|
|
257
|
+
});
|
|
258
|
+
if (existInspection)
|
|
259
|
+
continue;
|
|
260
|
+
// 새로운 체크리스트 데이터
|
|
261
|
+
const newChecklist = {
|
|
262
|
+
name: checklist.name,
|
|
263
|
+
location: `${buildingInspection.buildingLevel.building.name} ${buildingLevel.floor}층`,
|
|
264
|
+
constructionType: checklist.constructionType,
|
|
265
|
+
constructionDetailType: checklist.constructionDetailType,
|
|
266
|
+
inspectionDrawingType: checklist.inspectionDrawingType,
|
|
267
|
+
inspectionParts: checklist.inspectionParts
|
|
268
|
+
};
|
|
269
|
+
// 새로운 체크리스트 아이템 데이터
|
|
270
|
+
const newChecklistItems = checklistItems.map(item => ({
|
|
271
|
+
name: item.name,
|
|
272
|
+
mainType: item.mainType,
|
|
273
|
+
detailType: item.detailType,
|
|
274
|
+
inspctionCriteria: item.inspctionCriteria
|
|
275
|
+
}));
|
|
276
|
+
await this.createBuildingInspection({
|
|
277
|
+
buildingLevelId: buildingLevel.id,
|
|
278
|
+
checklist: newChecklist,
|
|
279
|
+
checklistItem: newChecklistItems,
|
|
280
|
+
cellX: buildingInspection.cellX,
|
|
281
|
+
cellY: buildingInspection.cellY,
|
|
282
|
+
managerId: buildingInspection.managerId
|
|
283
|
+
}, context);
|
|
215
284
|
}
|
|
216
|
-
return
|
|
285
|
+
return true;
|
|
217
286
|
}
|
|
218
287
|
};
|
|
219
288
|
exports.BuildingInspectionMutation = BuildingInspectionMutation;
|
|
@@ -241,7 +310,7 @@ tslib_1.__decorate([
|
|
|
241
310
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('patch')),
|
|
242
311
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
243
312
|
tslib_1.__metadata("design:type", Function),
|
|
244
|
-
tslib_1.__metadata("design:paramtypes", [building_inspection_type_1.
|
|
313
|
+
tslib_1.__metadata("design:paramtypes", [building_inspection_type_1.UpdateBuildingInspection, Object]),
|
|
245
314
|
tslib_1.__metadata("design:returntype", Promise)
|
|
246
315
|
], BuildingInspectionMutation.prototype, "updateBuildingInspection", null);
|
|
247
316
|
tslib_1.__decorate([
|
|
@@ -253,7 +322,49 @@ tslib_1.__decorate([
|
|
|
253
322
|
tslib_1.__metadata("design:paramtypes", [Array, Object]),
|
|
254
323
|
tslib_1.__metadata("design:returntype", Promise)
|
|
255
324
|
], BuildingInspectionMutation.prototype, "deleteBuildingInspections", null);
|
|
325
|
+
tslib_1.__decorate([
|
|
326
|
+
(0, type_graphql_1.Directive)('@transaction'),
|
|
327
|
+
(0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To apply to all building inspection' }),
|
|
328
|
+
tslib_1.__param(0, (0, type_graphql_1.Arg)('buildingInspectionId')),
|
|
329
|
+
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
330
|
+
tslib_1.__metadata("design:type", Function),
|
|
331
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
332
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
333
|
+
], BuildingInspectionMutation.prototype, "applyToAllBuildingInspection", null);
|
|
256
334
|
exports.BuildingInspectionMutation = BuildingInspectionMutation = tslib_1.__decorate([
|
|
257
335
|
(0, type_graphql_1.Resolver)(building_inspection_1.BuildingInspection)
|
|
258
336
|
], BuildingInspectionMutation);
|
|
337
|
+
async function getRecentDocumentNoByBuildingLevelId(buildingLevelId, type, tx) {
|
|
338
|
+
const project = await tx
|
|
339
|
+
.createQueryBuilder()
|
|
340
|
+
.select('p.documentNaming', 'documentNaming')
|
|
341
|
+
.addSelect('bc.id', 'buildingComplexId')
|
|
342
|
+
.from('projects', 'p')
|
|
343
|
+
.innerJoin('building_complexes', 'bc', 'bc.id = p.building_complex_id')
|
|
344
|
+
.innerJoin('buildings', 'b', 'b.building_complex_id = bc.id')
|
|
345
|
+
.innerJoin('building_levels', 'bl', 'bl.building_id = b.id')
|
|
346
|
+
.where('bl.id = :buildingLevelId', { buildingLevelId })
|
|
347
|
+
.getRawOne();
|
|
348
|
+
const latestChecklist = await tx
|
|
349
|
+
.getRepository(checklist_1.Checklist)
|
|
350
|
+
.createQueryBuilder('c')
|
|
351
|
+
.innerJoin('c.buildingInspection', 'bi')
|
|
352
|
+
.innerJoin('bi.buildingLevel', 'bl')
|
|
353
|
+
.innerJoin('bl.building', 'b')
|
|
354
|
+
.where('b.building_complex_id = :buildingComplexId', { buildingComplexId: project.buildingComplexId })
|
|
355
|
+
.andWhere('c.document_no LIKE :pattern', { pattern: `${project.documentNaming} 검측 제${type}-%` })
|
|
356
|
+
.orderBy('c.created_at', 'DESC')
|
|
357
|
+
.getOne();
|
|
358
|
+
// 4. 시퀀스 번호 생성 (5자리)
|
|
359
|
+
let sequence = '00001';
|
|
360
|
+
if (latestChecklist) {
|
|
361
|
+
const documentNoPattern = new RegExp(`${project.documentNaming} 검측 제${type}-(\\d{5})호`);
|
|
362
|
+
const match = latestChecklist.documentNo.match(documentNoPattern);
|
|
363
|
+
if (match) {
|
|
364
|
+
sequence = (Number(match[1]) + 1).toString().padStart(5, '0');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// 5. 최종 문서 번호 생성
|
|
368
|
+
return `${project.documentNaming} 검측 제${type}-${sequence}호`;
|
|
369
|
+
}
|
|
259
370
|
//# sourceMappingURL=building-inspection-mutation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"building-inspection-mutation.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,+DAA0D;AAC1D,yEAImC;AACnC,+DAAgE;AAChE,sDAAkD;AAClD,qEAAgE;AAChE,iDAAqD;AACrD,6DAAsD;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CACd,KAA4B,EACnC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAClC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,KAAK,CAAA;QAC3D,MAAM,4BAA4B,GAAG,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAA;QACzE,MAAM,mBAAmB,GAAG,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAA;QACvD,MAAM,uBAAuB,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;QAE/D,WAAW;QACX,IAAI,CAAC,eAAe;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;QACrD,IAAI,CAAC,SAAS,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACvD,IAAI,CAAC,SAAS,CAAC,gBAAgB;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;QAChE,IAAI,CAAC,SAAS,CAAC,sBAAsB;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACzE,IAAI,CAAC,SAAS,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAA;QACrD,IAAI,CAAC,SAAS,CAAC,qBAAqB;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACxE,IAA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AAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAiCP;qCA5OU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAoQtC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { BuildingInspection } from './building-inspection'\nimport {\n NewBuildingInspection,\n UpdateBuildingInspectionDrawingMarker,\n UpdateBuildingInspectionSubmitType\n} from './building-inspection-type'\nimport { BuildingInspectionStatus } from './building-inspection'\nimport { Checklist } from '../checklist/checklist'\nimport { ChecklistItem } from '../checklist-item/checklist-item'\nimport { getRepository } from '@things-factory/shell'\nimport { BuildingLevel } from '@dssp/building-complex'\n\n@Resolver(BuildingInspection)\nexport class BuildingInspectionMutation {\n @Directive('@transaction')\n @Mutation(returns => BuildingInspection, { description: 'To create Building Inspection information' })\n async createBuildingInspection(\n @Arg('patch') patch: NewBuildingInspection,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspection> {\n const { user, tx } = context.state\n const { buildingLevelId, checklist, checklistItem } = patch\n const buildingInspectionRepository = tx.getRepository(BuildingInspection)\n const checklistRepository = tx.getRepository(Checklist)\n const checklistItemRepository = tx.getRepository(ChecklistItem)\n\n // 1. 벨리데이션\n if (!buildingLevelId) throw new Error('층 아이디가 없습니다.')\n if (!checklist.name) throw new Error('체크리스트 이름이 없습니다.')\n if (!checklist.constructionType) throw new Error('공종 타입이 없습니다.')\n if (!checklist.constructionDetailType) throw new Error('상세 공종 타입이 없습니다.')\n if (!checklist.location) throw new Error('위치가 없습니다.')\n if (!checklist.inspectionDrawingType) throw new Error('검측 도면 타입이 없습니다.')\n if (checklist.inspectionParts.length === 0) throw new Error('검측 부위가 없습니다.')\n if (checklistItem.length === 0) throw new Error('체크리스트 아이템이 없습니다.')\n\n // 2. checklist 저장\n const documentNo = await this.getRecentDocumentNoByBuildingLevelId(buildingLevelId)\n const savedChecklist = await checklistRepository.save({\n ...checklist,\n documentNo,\n creator: user,\n updater: user\n })\n\n // 3. checklistItem 저장\n const checklistItems = checklistItem.map((item, idx) => ({\n name: item.name,\n mainType: item.mainType,\n detailType: item.detailType,\n inspctionCriteria: item.inspctionCriteria,\n sequence: idx,\n checklist: savedChecklist,\n creator: user,\n updater: user\n }))\n await checklistItemRepository.save(checklistItems)\n\n // 4. buildingInspection 저장\n const result = await buildingInspectionRepository.save({\n status: BuildingInspectionStatus.WAIT,\n buildingLevel: { id: buildingLevelId },\n checklist: savedChecklist,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n // 검측 상태 변경 & 체크리스트 갱신\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To create Building Inspection And Checklist information' })\n async updateBuildingInspectionChecklist(\n @Arg('buildingInspection') buildingInspection: UpdateBuildingInspectionSubmitType,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n const { id: buildingInspectionId, checklist, checklistItem } = buildingInspection\n const buildingInspectionRepo = tx.getRepository(BuildingInspection)\n const checklistRepo = tx.getRepository(Checklist)\n const checklistItemRepo = tx.getRepository(ChecklistItem)\n const oldBuildingInspection = await buildingInspectionRepo.findOneBy({ id: buildingInspectionId })\n const status = oldBuildingInspection.status\n const isConstructor: boolean =\n status == BuildingInspectionStatus.WAIT ||\n status == BuildingInspectionStatus.OVERALL_WAIT ||\n status == BuildingInspectionStatus.FAIL\n let inspectionStatus = null\n\n // 1. 벨리데이션\n if (!buildingInspectionId) throw new Error('검측 아이디가 없습니다.')\n if (!status) throw new Error('검측 상태가 없습니다.')\n if (status == BuildingInspectionStatus.PASS) throw new Error('검측 상태가 수정할 수 있는 상태가 아닙니다.')\n\n if (isConstructor) {\n // 시공자 타입별 밸리데이션\n if (checklistItem.length !== checklistItem.filter(v => v.constructionConfirmStatus).length) {\n throw new Error('아이템을 모두 체크해야 합니다.')\n }\n if (status == BuildingInspectionStatus.OVERALL_WAIT && !checklist.overallConstructorSignature) {\n throw new Error('총괄 시공책임자 사인이 없습니다.')\n }\n if (status == BuildingInspectionStatus.WAIT && !checklist.taskConstructorSignature) {\n throw new Error('공종별 시공관리자 사인이 없습니다.')\n }\n\n // 시공자 상태 데이터\n const isPassed = checklistItem.length === checklistItem.filter(v => v.constructionConfirmStatus === 'T').length\n\n if (!isPassed) {\n // 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.FAIL\n checklist.overallConstructorSignature = null\n checklist.taskConstructorSignature = null\n } else if (isPassed && (status === BuildingInspectionStatus.WAIT || status === BuildingInspectionStatus.FAIL)) {\n // 2. 검측이 합격이면서 공종 시공자 스탭 = 상태는 총괄 시공자 스탭으로\n inspectionStatus = BuildingInspectionStatus.OVERALL_WAIT\n } else if (isPassed && status === BuildingInspectionStatus.OVERALL_WAIT) {\n // 3. 검측이 합격이면서 총괄 시공자 스탭 = 상태는 공종 감리자 스탭으로, 감리자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.REQUEST\n checklist.overallSupervisorySignature = null\n checklist.taskSupervisorySignature = null\n }\n } else {\n // 감리자 타입별 밸리데이션\n if (checklistItem.length !== checklistItem.filter(v => v.supervisoryConfirmStatus).length) {\n throw new Error('아이템을 모두 체크해야 합니다.')\n }\n if (status == BuildingInspectionStatus.OVERALL_REQUEST && !checklist.overallSupervisorySignature) {\n throw new Error('총괄 감리책임자 사인이 없습니다.')\n }\n if (status == BuildingInspectionStatus.REQUEST && !checklist.taskSupervisorySignature) {\n throw new Error('공종별 감리 책임자 사인이 없습니다.')\n }\n\n // 감리자 상태 데이터\n const isPassed = checklistItem.length === checklistItem.filter(v => v.supervisoryConfirmStatus === 'T').length\n if (!isPassed) {\n // 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.FAIL\n checklist.overallConstructorSignature = null\n checklist.taskConstructorSignature = null\n } else if (isPassed && status === BuildingInspectionStatus.REQUEST) {\n // 2. 검측이 합격이면서 공종 감리자 스탭 = 상태는 총괄 감리자 스탭으로\n inspectionStatus = BuildingInspectionStatus.OVERALL_REQUEST\n } else if (isPassed && status === BuildingInspectionStatus.OVERALL_REQUEST) {\n // 3. 검측이 합격이면서 총괄 감리자 스탭 = 상태는 합격으로\n inspectionStatus = BuildingInspectionStatus.PASS\n }\n }\n\n // 2. buildingInspection 저장\n await buildingInspectionRepo.save({\n ...oldBuildingInspection,\n status: inspectionStatus,\n updater: user\n })\n\n // 3. checklist 저장\n const oldChecklist = await checklistRepo.findOneBy({ id: checklist.id })\n const inspectionDateField = isConstructor ? 'constructionInspectionDate' : 'supervisorInspectionDate'\n await checklistRepo.save({\n ...oldChecklist,\n [inspectionDateField]: new Date(),\n overallConstructorSignature: checklist.overallConstructorSignature,\n taskConstructorSignature: checklist.taskConstructorSignature,\n overallSupervisorySignature: checklist.overallSupervisorySignature,\n taskSupervisorySignature: checklist.taskSupervisorySignature,\n updater: user\n })\n\n // 4. checklistItem 저장\n for (let item of checklistItem) {\n const confirmStatusField = isConstructor ? 'constructionConfirmStatus' : 'supervisoryConfirmStatus'\n await checklistItemRepo.update(item.id, {\n [confirmStatusField]: item[confirmStatusField],\n updater: user\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => BuildingInspection, { description: 'To update Building Inspection information' })\n async updateBuildingInspection(\n @Arg('patch') patch: UpdateBuildingInspectionDrawingMarker,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspection> {\n const { user, tx } = context.state\n const buildingInspectionRepo = tx.getRepository(BuildingInspection)\n\n // 벨리데이션\n if (!patch.id) throw new Error('검측 아이디가 없습니다.')\n\n const buildingInspection = await buildingInspectionRepo.findOneBy({ id: patch.id })\n\n // 완료 상태인 검측데이터면 삭제 못함\n if (buildingInspection.status === BuildingInspectionStatus.PASS) {\n throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')\n }\n\n const result = await buildingInspectionRepo.save({\n ...buildingInspection,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Checklists' })\n async deleteBuildingInspections(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n const buildingInspectionRepository = tx.getRepository(BuildingInspection)\n const checklistRepository = tx.getRepository(Checklist)\n const checklistItemRepository = tx.getRepository(ChecklistItem)\n\n const buildingInspections = await buildingInspectionRepository.createQueryBuilder('bi').whereInIds(ids).getMany()\n\n // 완료 상태인 검측데이터가 한개라도 있으면 삭제 못함\n if (buildingInspections.filter(bi => bi.status === BuildingInspectionStatus.PASS).length > 0) {\n throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')\n }\n\n // 검측 데이터 제거\n await buildingInspectionRepository.softDelete({\n id: In(ids)\n })\n\n // 검측 데이터의 체크 리스트 제거\n const checklistIds = buildingInspections.map(bi => bi.checklistId)\n await checklistRepository.softDelete({\n id: In(checklistIds)\n })\n\n // 검측 데이터의 체크 리스트 아이템 제거\n await checklistItemRepository\n .createQueryBuilder()\n .softDelete()\n .where('checklist_id IN (:...checklistIds)', { checklistIds })\n .execute()\n\n return true\n }\n\n async getRecentDocumentNoByBuildingLevelId(buildingLevelId: string): Promise<string> {\n const buildingLevel = await getRepository(BuildingLevel).findOne({\n where: { id: buildingLevelId },\n relations: ['building']\n })\n\n const buildingName = buildingLevel.building.name.match(/\\d+/g)?.join('')?.padStart(4, '0') || '0000'\n const floorName = buildingLevel.floor.toString().padStart(3, '0')\n const latestChecklist = await getRepository(Checklist)\n .createQueryBuilder('c')\n .where('c.document_no LIKE :pattern', { pattern: `${buildingName}-${floorName}-%` })\n .orderBy('c.created_at', 'DESC')\n .getOne()\n\n let documentNo = '000001'\n if (latestChecklist) {\n const lastNo = latestChecklist.documentNo.split('-')[2]\n documentNo = (Number(lastNo) + 1).toString().padStart(6, '0')\n }\n\n return `${buildingName}-${floorName}-${documentNo}`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"building-inspection-mutation.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAC5B,+DAAuE;AACvE,yEAAgI;AAChI,+DAAgE;AAChE,sDAAkE;AAClE,qEAAgE;AAChE,iDAAqD;AACrD,6DAAsD;AACtD,6CAA4C;AAC5C,sDAA+D;AAE/D,MAAM,WAAW,GAAG,YAAM,CAAC,GAAG,CAAC,aAAa,EAAE,iCAAW,CAAC,IAAI,CAAC,CAAA;AAGxD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CACd,KAA4B,EACnC,OAAwB;QAE/B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAClC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;QACpF,MAAM,4BAA4B,GAAG,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAA;QACzE,MAAM,mBAAmB,GAAG,EAAE,CAAC,aAAa,CAAC,qBAAS,CAAC,CAAA;QACvD,MAAM,uBAAuB,GAAG,EAAE,CAAC,aAAa,CAAC,8BAAa,CAAC,CAAA;QAE/D,WAAW;QACX,IAAI,CAAC,SAAS,CAAC,gBAAgB;YAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;QAChE,IAAI,CAAC,SAAS,CAAC,sBAAsB;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACzE,IAAI,CAAC,SAAS,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACvD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,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EAAE,eAAe,EAAE,CAAC;SACtD,SAAS,EAAE,CAAA;IAEd,MAAM,eAAe,GAAG,MAAM,EAAE;SAC7B,aAAa,CAAC,qBAAS,CAAC;SACxB,kBAAkB,CAAC,GAAG,CAAC;SACvB,SAAS,CAAC,sBAAsB,EAAE,IAAI,CAAC;SACvC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC;SACnC,SAAS,CAAC,aAAa,EAAE,GAAG,CAAC;SAC7B,KAAK,CAAC,4CAA4C,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC;SACrG,QAAQ,CAAC,6BAA6B,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,cAAc,QAAQ,IAAI,IAAI,EAAE,CAAC;SAC/F,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC;SAC/B,MAAM,EAAE,CAAA;IAEX,qBAAqB;IACrB,IAAI,QAAQ,GAAG,OAAO,CAAA;IACtB,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,QAAQ,IAAI,YAAY,CAAC,CAAA;QACvF,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACjE,IAAI,KAAK,EAAE,CAAC;YACV,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;QAC/D,CAAC;IACH,CAAC;IAED,iBAAiB;IACjB,OAAO,GAAG,OAAO,CAAC,cAAc,QAAQ,IAAI,IAAI,QAAQ,GAAG,CAAA;AAC7D,CAAC","sourcesContent":["import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'\nimport { In } from 'typeorm'\nimport { BuildingInspection, ProjectType } from './building-inspection'\nimport { NewBuildingInspection, UpdateBuildingInspection, UpdateBuildingInspectionSubmitType } from './building-inspection-type'\nimport { BuildingInspectionStatus } from './building-inspection'\nimport { Checklist, DocumentNoType } from '../checklist/checklist'\nimport { ChecklistItem } from '../checklist-item/checklist-item'\nimport { getRepository } from '@things-factory/shell'\nimport { BuildingLevel } from '@dssp/building-complex'\nimport { config } from '@things-factory/env'\nimport { ChecklistReferenceType } from '../checklist/checklist'\n\nconst projectType = config.get('projectType', ProjectType.DSSP)\n\n@Resolver(BuildingInspection)\nexport class BuildingInspectionMutation {\n @Directive('@transaction')\n @Mutation(returns => BuildingInspection, { description: 'To create Building Inspection information' })\n async createBuildingInspection(\n @Arg('patch') patch: NewBuildingInspection,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspection> {\n const { user, tx } = context.state\n const { buildingLevelId, checklist, checklistItem, cellX, cellY, managerId } = patch\n const buildingInspectionRepository = tx.getRepository(BuildingInspection)\n const checklistRepository = tx.getRepository(Checklist)\n const checklistItemRepository = tx.getRepository(ChecklistItem)\n\n // 1. 벨리데이션\n if (!checklist.constructionType) throw new Error('공종 타입이 없습니다.')\n if (!checklist.constructionDetailType) throw new Error('상세 공종 타입이 없습니다.')\n if (!checklist.name) throw new Error('체크리스트 이름이 없습니다.')\n if (checklistItem.length === 0) throw new Error('체크리스트 아이템이 없습니다.')\n\n if (projectType === ProjectType.DSSP) {\n if (!cellX || !cellY) throw new Error('셀 좌표가 없습니다.')\n if (!managerId) throw new Error('담당자가 없습니다.')\n if (!buildingLevelId) throw new Error('층 아이디가 없습니다.')\n if (!checklist.location) throw new Error('위치가 없습니다.')\n } else if (projectType === ProjectType.DCSP) {\n if (!checklist.inspectionDrawingType) throw new Error('검측 도면 타입이 없습니다.')\n if (checklist.inspectionParts.length === 0) throw new Error('검측 부위가 없습니다.')\n if (!buildingLevelId) throw new Error('층 아이디가 없습니다.')\n if (!checklist.location) throw new Error('위치가 없습니다.')\n }\n\n // 2. checklist 저장\n const checklistDocumentNo = await getRecentDocumentNoByBuildingLevelId(buildingLevelId, DocumentNoType.CHECKLIST, tx)\n const inspectionRequestDocumentNo = checklistDocumentNo.replace(\n `검측 제${DocumentNoType.CHECKLIST}-`,\n `검측 제${DocumentNoType.INSPECTION_REQUEST}-`\n )\n const inspectionResultDocumentNo = checklistDocumentNo.replace(\n `검측 제${DocumentNoType.CHECKLIST}-`,\n `검측 제${DocumentNoType.INSPECTION_RESULT}-`\n )\n\n const savedChecklist = await checklistRepository.save({\n ...checklist,\n projectType,\n checklistReferenceType: ChecklistReferenceType.INSPECTION,\n documentNo: checklistDocumentNo,\n inspectionRequestDocumentNo,\n inspectionResultDocumentNo,\n creator: user,\n updater: user\n })\n\n // 3. checklistItem 저장\n const checklistItems = checklistItem.map((item, idx) => ({\n name: item.name,\n mainType: item.mainType,\n detailType: item.detailType,\n inspctionCriteria: item.inspctionCriteria,\n sequence: idx,\n checklist: savedChecklist,\n creator: user,\n updater: user\n }))\n await checklistItemRepository.save(checklistItems)\n\n // 4. buildingInspection 저장\n const result = await buildingInspectionRepository.save({\n status: BuildingInspectionStatus.WAIT,\n buildingLevel: { id: buildingLevelId },\n checklist: savedChecklist,\n projectType,\n manager: managerId ? { id: managerId } : null,\n cellX,\n cellY,\n creator: user,\n updater: user\n })\n\n return result\n }\n\n // 검측 상태 변경 & 체크리스트 갱신\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To create Building Inspection And Checklist information' })\n async updateBuildingInspectionChecklist(\n @Arg('buildingInspection') buildingInspection: UpdateBuildingInspectionSubmitType,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n const { id: buildingInspectionId, memo, checklist, checklistItem } = buildingInspection\n const buildingInspectionRepo = tx.getRepository(BuildingInspection)\n const checklistRepo = tx.getRepository(Checklist)\n const checklistItemRepo = tx.getRepository(ChecklistItem)\n const oldBuildingInspection = await buildingInspectionRepo.findOneBy({ id: buildingInspectionId })\n const status = oldBuildingInspection.status\n const isConstructor: boolean =\n status == BuildingInspectionStatus.WAIT ||\n status == BuildingInspectionStatus.OVERALL_WAIT ||\n status == BuildingInspectionStatus.FAIL\n let inspectionStatus = null\n let signedUserType = null // 싸인을 한 유저 타입\n let inspectionRequestData = {}\n let inspectionResultData = {}\n\n // 1. 벨리데이션\n if (!buildingInspectionId) throw new Error('검측 아이디가 없습니다.')\n if (!status) throw new Error('검측 상태가 없습니다.')\n if (status == BuildingInspectionStatus.PASS) throw new Error('검측 상태가 수정할 수 있는 상태가 아닙니다.')\n\n if (isConstructor) {\n // 시공자 타입별 밸리데이션\n if (checklistItem.length !== checklistItem.filter(v => v.constructionConfirmStatus).length) {\n throw new Error('아이템을 모두 체크해야 합니다.')\n }\n if (status == BuildingInspectionStatus.OVERALL_WAIT && !checklist.overallConstructorSignature) {\n throw new Error('총괄 시공책임자 사인이 없습니다.')\n }\n if (status == BuildingInspectionStatus.WAIT && !checklist.taskConstructorSignature) {\n throw new Error('공종별 시공관리자 사인이 없습니다.')\n }\n\n // 시공자 상태 데이터\n const isPassed = checklistItem.length === checklistItem.filter(v => v.constructionConfirmStatus === 'T').length\n\n if (!isPassed) {\n // 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.FAIL\n checklist.overallConstructorSignature = null\n checklist.taskConstructorSignature = null\n } else if (isPassed && (status === BuildingInspectionStatus.WAIT || status === BuildingInspectionStatus.FAIL)) {\n // 2. 검측이 합격이면서 공종 시공자 스탭 = 상태는 총괄 시공자 스탭으로\n inspectionStatus = BuildingInspectionStatus.OVERALL_WAIT\n signedUserType = 'taskConstructor'\n } else if (isPassed && status === BuildingInspectionStatus.OVERALL_WAIT) {\n // 3. 검측이 합격이면서 총괄 시공자 스탭 = 상태는 공종 감리자 스탭으로, 감리자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.REQUEST\n checklist.overallSupervisorySignature = null\n checklist.taskSupervisorySignature = null\n signedUserType = 'overallConstructor'\n inspectionRequestData = {\n inspectionRequestMemo: checklist.inspectionRequestMemo,\n inspectionRequestUpdatedAt: new Date()\n }\n }\n } else {\n // 감리자 타입별 밸리데이션\n if (checklistItem.length !== checklistItem.filter(v => v.supervisoryConfirmStatus).length) {\n throw new Error('아이템을 모두 체크해야 합니다.')\n }\n if (status == BuildingInspectionStatus.OVERALL_REQUEST && !checklist.overallSupervisorySignature) {\n throw new Error('총괄 감리책임자 사인이 없습니다.')\n }\n if (status == BuildingInspectionStatus.REQUEST && !checklist.taskSupervisorySignature) {\n throw new Error('공종별 감리 책임자 사인이 없습니다.')\n }\n\n // 감리자 상태 데이터\n const isPassed = checklistItem.length === checklistItem.filter(v => v.supervisoryConfirmStatus === 'T').length\n if (!isPassed) {\n // 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화\n inspectionStatus = BuildingInspectionStatus.FAIL\n checklist.overallConstructorSignature = null\n checklist.taskConstructorSignature = null\n } else if (isPassed && status === BuildingInspectionStatus.REQUEST) {\n // 2. 검측이 합격이면서 공종 감리자 스탭 = 상태는 총괄 감리자 스탭으로\n inspectionStatus = BuildingInspectionStatus.OVERALL_REQUEST\n signedUserType = 'taskSupervisory'\n } else if (isPassed && status === BuildingInspectionStatus.OVERALL_REQUEST) {\n // 3. 검측이 합격이면서 총괄 감리자 스탭 = 상태는 합격으로\n inspectionStatus = BuildingInspectionStatus.PASS\n signedUserType = 'overallSupervisory'\n inspectionResultData = {\n inspectionResultStatus: checklist.inspectionResultStatus,\n inspectionResultMemo: checklist.inspectionResultMemo,\n inspectionResultType: checklist.inspectionResultType,\n inspectionResultUpdatedAt: new Date()\n }\n }\n }\n\n // 2. buildingInspection 저장\n await buildingInspectionRepo.save({\n ...oldBuildingInspection,\n status: inspectionStatus,\n memo: memo,\n updater: user\n })\n\n // 3. checklist 저장\n const oldChecklist = await checklistRepo.findOneBy({ id: checklist.id })\n const inspectionDateField = isConstructor ? 'constructionInspectionDate' : 'supervisorInspectionDate'\n const signedUser = signedUserType ? { [signedUserType]: user } : {}\n\n await checklistRepo.save({\n ...oldChecklist,\n [inspectionDateField]: new Date(),\n overallConstructorSignature: checklist.overallConstructorSignature,\n taskConstructorSignature: checklist.taskConstructorSignature,\n overallSupervisorySignature: checklist.overallSupervisorySignature,\n taskSupervisorySignature: checklist.taskSupervisorySignature,\n ...signedUser,\n ...inspectionRequestData,\n ...inspectionResultData,\n updater: user\n })\n\n // 4. checklistItem 저장\n for (let item of checklistItem) {\n const confirmStatusField = isConstructor ? 'constructionConfirmStatus' : 'supervisoryConfirmStatus'\n await checklistItemRepo.update(item.id, {\n [confirmStatusField]: item[confirmStatusField],\n updater: user\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => BuildingInspection, { description: 'To update Building Inspection information' })\n async updateBuildingInspection(\n @Arg('patch') patch: UpdateBuildingInspection,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspection> {\n const { user, tx } = context.state\n const buildingInspectionRepo = tx.getRepository(BuildingInspection)\n\n // 벨리데이션\n if (!patch.id) throw new Error('검측 아이디가 없습니다.')\n\n const buildingInspection = await buildingInspectionRepo.findOneBy({ id: patch.id })\n\n // 완료 상태인 검측데이터면 삭제 못함\n if (buildingInspection.status === BuildingInspectionStatus.PASS) {\n throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')\n }\n\n const result = await buildingInspectionRepo.save({\n ...buildingInspection,\n ...patch,\n updater: user\n })\n\n return result\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple Checklists' })\n async deleteBuildingInspections(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { tx } = context.state\n const buildingInspectionRepository = tx.getRepository(BuildingInspection)\n const checklistRepository = tx.getRepository(Checklist)\n const checklistItemRepository = tx.getRepository(ChecklistItem)\n\n const buildingInspections = await buildingInspectionRepository.createQueryBuilder('bi').whereInIds(ids).getMany()\n\n // 완료 상태인 검측데이터가 한개라도 있으면 삭제 못함\n if (buildingInspections.filter(bi => bi.status === BuildingInspectionStatus.PASS).length > 0) {\n throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')\n }\n\n // 검측 데이터 제거\n await buildingInspectionRepository.softDelete({\n id: In(ids)\n })\n\n // 검측 데이터의 체크 리스트 제거\n const checklistIds = buildingInspections.map(bi => bi.checklistId)\n await checklistRepository.softDelete({\n id: In(checklistIds)\n })\n\n // 검측 데이터의 체크 리스트 아이템 제거\n await checklistItemRepository\n .createQueryBuilder()\n .softDelete()\n .where('checklist_id IN (:...checklistIds)', { checklistIds })\n .execute()\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To apply to all building inspection' })\n async applyToAllBuildingInspection(\n @Arg('buildingInspectionId') buildingInspectionId: string,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n const buildingInspectionRepository = tx.getRepository(BuildingInspection)\n\n const buildingInspection = await buildingInspectionRepository.findOne({\n where: { id: buildingInspectionId },\n relations: ['buildingLevel', 'buildingLevel.building', 'checklist', 'checklist.checklistItems']\n })\n\n const checklist = buildingInspection.checklist\n const checklistItems = checklist.checklistItems\n const buildingLevels = await getRepository(BuildingLevel).find({\n where: { building: { id: buildingInspection.buildingLevel.building.id } }\n })\n\n // 해당 검측 정보가 속한 동의 모든 층에 같은 검측 데이터 등록\n for (let buildingLevel of buildingLevels) {\n // 같은 셀에 이미 검측 정보가 있으면 패스\n const existInspection = await buildingInspectionRepository.findOneBy({\n buildingLevel: { id: buildingLevel.id },\n cellX: buildingInspection.cellX,\n cellY: buildingInspection.cellY\n })\n if (existInspection) continue\n\n // 새로운 체크리스트 데이터\n const newChecklist = {\n name: checklist.name,\n location: `${buildingInspection.buildingLevel.building.name} ${buildingLevel.floor}층`,\n constructionType: checklist.constructionType,\n constructionDetailType: checklist.constructionDetailType,\n inspectionDrawingType: checklist.inspectionDrawingType,\n inspectionParts: checklist.inspectionParts\n }\n\n // 새로운 체크리스트 아이템 데이터\n const newChecklistItems = checklistItems.map(item => ({\n name: item.name,\n mainType: item.mainType,\n detailType: item.detailType,\n inspctionCriteria: item.inspctionCriteria\n }))\n\n await this.createBuildingInspection(\n {\n buildingLevelId: buildingLevel.id,\n checklist: newChecklist,\n checklistItem: newChecklistItems,\n cellX: buildingInspection.cellX,\n cellY: buildingInspection.cellY,\n managerId: buildingInspection.managerId\n },\n context\n )\n }\n\n return true\n }\n}\n\nasync function getRecentDocumentNoByBuildingLevelId(buildingLevelId: string, type: DocumentNoType, tx: any): Promise<string> {\n const project = await tx\n .createQueryBuilder()\n .select('p.documentNaming', 'documentNaming')\n .addSelect('bc.id', 'buildingComplexId')\n .from('projects', 'p')\n .innerJoin('building_complexes', 'bc', 'bc.id = p.building_complex_id')\n .innerJoin('buildings', 'b', 'b.building_complex_id = bc.id')\n .innerJoin('building_levels', 'bl', 'bl.building_id = b.id')\n .where('bl.id = :buildingLevelId', { buildingLevelId })\n .getRawOne()\n\n const latestChecklist = await tx\n .getRepository(Checklist)\n .createQueryBuilder('c')\n .innerJoin('c.buildingInspection', 'bi')\n .innerJoin('bi.buildingLevel', 'bl')\n .innerJoin('bl.building', 'b')\n .where('b.building_complex_id = :buildingComplexId', { buildingComplexId: project.buildingComplexId })\n .andWhere('c.document_no LIKE :pattern', { pattern: `${project.documentNaming} 검측 제${type}-%` })\n .orderBy('c.created_at', 'DESC')\n .getOne()\n\n // 4. 시퀀스 번호 생성 (5자리)\n let sequence = '00001'\n if (latestChecklist) {\n const documentNoPattern = new RegExp(`${project.documentNaming} 검측 제${type}-(\\\\d{5})호`)\n const match = latestChecklist.documentNo.match(documentNoPattern)\n if (match) {\n sequence = (Number(match[1]) + 1).toString().padStart(5, '0')\n }\n }\n\n // 5. 최종 문서 번호 생성\n return `${project.documentNaming} 검측 제${type}-${sequence}호`\n}\n"]}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Attachment } from '@things-factory/attachment-base';
|
|
2
2
|
import { ListParam } from '@things-factory/shell';
|
|
3
3
|
import { BuildingInspection } from './building-inspection';
|
|
4
|
-
import { BuildingInspectionList, BuildingInspectionsOfBuildingLevel, BuildingInspectionsOfProject, BuildingInspectionSummary } from './building-inspection-type';
|
|
4
|
+
import { BuildingInspectionList, BuildingInspectionsOfBuildingLevel, BuildingInspectionsOfProject, BuildingInspectionSummary, ProjectManagerOutput } from './building-inspection-type';
|
|
5
5
|
import { BuildingLevel } from '@dssp/building-complex';
|
|
6
6
|
import { Checklist } from '../checklist/checklist';
|
|
7
|
-
import { Project } from '@dssp/project';
|
|
8
7
|
export declare class BuildingInspectionQuery {
|
|
9
8
|
buildingInspection(id: string, context: ResolverContext): Promise<BuildingInspection>;
|
|
10
9
|
buildingInspections(params: ListParam, context: ResolverContext): Promise<BuildingInspectionList>;
|
|
11
10
|
buildingInspectionsOfProject(params: BuildingInspectionsOfProject, context: ResolverContext): Promise<BuildingInspectionList>;
|
|
12
|
-
projectByBuildingLevelId(buildingLevelId: string, context: ResolverContext): Promise<Project>;
|
|
13
11
|
buildingInspectionsOfBuildingLevel(params: BuildingInspectionsOfBuildingLevel, context: ResolverContext): Promise<BuildingInspectionList>;
|
|
14
12
|
buildingInspectionSummaryOfBuildingLevel(buildingLevelId: string, context: ResolverContext): Promise<BuildingInspectionSummary>;
|
|
15
13
|
buildingInspectionDateSummaryOfLevelAndPeriod(buildingLevelId: string, startDate: string, endDate: string, context: ResolverContext): Promise<BuildingInspectionSummary[]>;
|
|
@@ -17,5 +15,6 @@ export declare class BuildingInspectionQuery {
|
|
|
17
15
|
buildingInspectionSummaryOfProject(projectId: string, context: ResolverContext): Promise<BuildingInspectionSummary>;
|
|
18
16
|
checklist(buildingInspection: BuildingInspection): Promise<Checklist>;
|
|
19
17
|
buildingLevel(buildingInspection: BuildingInspection): Promise<BuildingLevel>;
|
|
20
|
-
|
|
18
|
+
attachments(buildingInspection: BuildingInspection): Promise<Attachment[] | undefined>;
|
|
19
|
+
manager(buildingInspection: BuildingInspection): Promise<ProjectManagerOutput>;
|
|
21
20
|
}
|