@dssp/supervision 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +66 -0
- package/dist-client/graphql/building-inspection.js.map +1 -0
- package/dist-client/pages/action-plan/action-plan-importer.js.map +1 -1
- package/dist-client/pages/action-plan/action-plan-list-page.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-camera.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +2 -68
- 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 +0 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +16 -11
- 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 +3 -2
- package/dist-client/pages/building-inspection/building-inspection-list.js +118 -13
- 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/inspection-event-provider.js +3 -3
- package/dist-client/pages/building-inspection/component/inspection-event-provider.js.map +1 -1
- package/dist-client/pages/building-inspection/inspection-create-popup.js +5 -4
- 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 +46 -0
- package/dist-client/pages/building-inspection-grid/building-inspection-grid-detail.js +953 -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 +734 -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/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.js +9 -2
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/checklist-view.d.ts +2 -0
- package/dist-client/pages/checklist/checklist-view.js +288 -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.map +1 -1
- 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 +1 -1
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -1
- package/dist-client/pages/checklist-template/checklist-type-management.d.ts +2 -2
- package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -1
- package/dist-client/pages/issue/issue-importer.js.map +1 -1
- package/dist-client/pages/issue/issue-list-page.js.map +1 -1
- package/dist-client/pages/project-report/project-report-importer.js.map +1 -1
- package/dist-client/pages/project-report/project-report-list-page.js.map +1 -1
- package/dist-client/pages/supervisor/supervisor-importer.js.map +1 -1
- package/dist-client/pages/supervisor/supervisor-list-page.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/middlewares/index.js +1 -2
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-mutation.js +2 -2
- package/dist-server/service/action-plan/action-plan-mutation.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-query.js +2 -2
- package/dist-server/service/action-plan/action-plan-query.js.map +1 -1
- package/dist-server/service/action-plan/action-plan-type.js +6 -6
- package/dist-server/service/action-plan/action-plan-type.js.map +1 -1
- package/dist-server/service/action-plan/action-plan.js +3 -3
- package/dist-server/service/action-plan/action-plan.js.map +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.js +2 -2
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.js +111 -32
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +2 -3
- package/dist-server/service/building-inspection/building-inspection-query.js +39 -29
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +18 -8
- package/dist-server/service/building-inspection/building-inspection-type.js +71 -25
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection.d.ts +9 -0
- package/dist-server/service/building-inspection/building-inspection.js +43 -5
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
- package/dist-server/service/building-inspection/index.d.ts +3 -5
- package/dist-server/service/building-inspection/index.js +10 -4
- package/dist-server/service/building-inspection/index.js.map +1 -1
- package/dist-server/service/checklist/checklist-history.d.ts +8 -0
- package/dist-server/service/checklist/checklist-history.js +38 -2
- 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 +3 -69
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -1
- package/dist-server/service/checklist/checklist-query.js +2 -2
- 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 +3 -51
- package/dist-server/service/checklist/checklist-type.js.map +1 -1
- package/dist-server/service/checklist/checklist.d.ts +15 -3
- package/dist-server/service/checklist/checklist.js +61 -17
- package/dist-server/service/checklist/checklist.js.map +1 -1
- package/dist-server/service/checklist/index.d.ts +0 -2
- package/dist-server/service/checklist/index.js +1 -3
- package/dist-server/service/checklist/index.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-mutation.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-mutation.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-query.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-type.js +2 -2
- package/dist-server/service/checklist-item/checklist-item-type.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item.js +3 -3
- package/dist-server/service/checklist-item/checklist-item.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-history.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment-history.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 +35 -8
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-query.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment-query.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-type.js +6 -6
- package/dist-server/service/checklist-item-comment/checklist-item-comment-type.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment.js +2 -2
- package/dist-server/service/checklist-item-comment/checklist-item-comment.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-template/checklist-template-mutation.js +2 -2
- package/dist-server/service/checklist-template/checklist-template-mutation.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template-query.js +2 -2
- package/dist-server/service/checklist-template/checklist-template-query.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template-type.js +4 -4
- package/dist-server/service/checklist-template/checklist-template-type.js.map +1 -1
- package/dist-server/service/checklist-template/checklist-template.js +2 -2
- package/dist-server/service/checklist-template/checklist-template.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +2 -2
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js +2 -2
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js +4 -4
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -1
- package/dist-server/service/checklist-template-item/checklist-template-item.js +4 -6
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-mutation.js +2 -2
- package/dist-server/service/checklist-type/checklist-type-mutation.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-query.js +2 -2
- package/dist-server/service/checklist-type/checklist-type-query.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type-type.js +4 -4
- package/dist-server/service/checklist-type/checklist-type-type.js.map +1 -1
- package/dist-server/service/checklist-type/checklist-type.js +3 -3
- package/dist-server/service/checklist-type/checklist-type.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/service/index.js +2 -11
- 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/issue/issue-mutation.js +2 -2
- package/dist-server/service/issue/issue-mutation.js.map +1 -1
- package/dist-server/service/issue/issue-query.js +2 -2
- package/dist-server/service/issue/issue-query.js.map +1 -1
- package/dist-server/service/issue/issue-type.js +6 -6
- package/dist-server/service/issue/issue-type.js.map +1 -1
- package/dist-server/service/issue/issue.js +3 -3
- package/dist-server/service/issue/issue.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-mutation.js +2 -2
- package/dist-server/service/project-report/project-report-mutation.js.map +1 -1
- package/dist-server/service/project-report/project-report-query.js +2 -2
- package/dist-server/service/project-report/project-report-query.js.map +1 -1
- package/dist-server/service/project-report/project-report-type.js +6 -6
- package/dist-server/service/project-report/project-report-type.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 +3 -9
- 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/service/supervisor/supervisor-mutation.js +2 -2
- package/dist-server/service/supervisor/supervisor-mutation.js.map +1 -1
- package/dist-server/service/supervisor/supervisor-query.js +2 -2
- package/dist-server/service/supervisor/supervisor-query.js.map +1 -1
- package/dist-server/service/supervisor/supervisor-type.js +6 -6
- package/dist-server/service/supervisor/supervisor-type.js.map +1 -1
- package/dist-server/service/supervisor/supervisor.js +3 -3
- package/dist-server/service/supervisor/supervisor.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -13
- package/things-factory.config.js +3 -1
- package/dist-server/service/building-inspection/event-subscriber.d.ts +0 -7
- package/dist-server/service/building-inspection/event-subscriber.js +0 -21
- package/dist-server/service/building-inspection/event-subscriber.js.map +0 -1
- package/dist-server/service/checklist/event-subscriber.d.ts +0 -7
- package/dist-server/service/checklist/event-subscriber.js +0 -21
- package/dist-server/service/checklist/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
|
@@ -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;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AAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAE5E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAiCP;AA5OU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CAoQtC;AApQY,gEAA0B","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,yEAImC;AACnC,+DAAgE;AAChE,sDAAkD;AAClD,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,IA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ingInspection, ProjectType } 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'\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 documentNo = await getRecentDocumentNoByBuildingLevelId(buildingLevelId)\n const savedChecklist = await checklistRepository.save({\n ...checklist,\n projectType,\n checklistReferenceType: ChecklistReferenceType.INSPECTION,\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 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, 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 @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 = ''): Promise<string> {\n let buildingName = '0000'\n let floorName = '000'\n\n // 빌딩 층 아이디가 있으면 빌딩 이름과 층 번호 추출\n if (buildingLevelId) {\n const buildingLevel = await getRepository(BuildingLevel).findOne({ where: { id: buildingLevelId }, relations: ['building'] })\n\n buildingName = buildingLevel?.building?.name?.match(/\\d+/g)?.join('')?.padStart(4, '0') || '0000'\n floorName = buildingLevel?.floor?.toString().padStart(3, '0') || '000'\n }\n\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"]}
|
|
@@ -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[]>;
|
|
@@ -18,4 +16,5 @@ export declare class BuildingInspectionQuery {
|
|
|
18
16
|
checklist(buildingInspection: BuildingInspection): Promise<Checklist>;
|
|
19
17
|
buildingLevel(buildingInspection: BuildingInspection): Promise<BuildingLevel>;
|
|
20
18
|
attatchments(buildingInspection: BuildingInspection): Promise<Attachment[] | undefined>;
|
|
19
|
+
manager(buildingInspection: BuildingInspection): Promise<ProjectManagerOutput>;
|
|
21
20
|
}
|
|
@@ -9,11 +9,13 @@ const building_inspection_1 = require("./building-inspection");
|
|
|
9
9
|
const building_inspection_type_1 = require("./building-inspection-type");
|
|
10
10
|
const building_complex_1 = require("@dssp/building-complex");
|
|
11
11
|
const checklist_1 = require("../checklist/checklist");
|
|
12
|
-
const
|
|
12
|
+
const env_1 = require("@things-factory/env");
|
|
13
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
14
|
+
const projectType = env_1.config.get('projectType', building_inspection_1.ProjectType.DSSP);
|
|
13
15
|
let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
14
16
|
async buildingInspection(id, context) {
|
|
15
17
|
return await (0, shell_1.getRepository)(building_inspection_1.BuildingInspection).findOne({
|
|
16
|
-
where: { id }
|
|
18
|
+
where: { id, projectType }
|
|
17
19
|
});
|
|
18
20
|
}
|
|
19
21
|
async buildingInspections(params, context) {
|
|
@@ -22,7 +24,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
22
24
|
params,
|
|
23
25
|
repository: await (0, shell_1.getRepository)(building_inspection_1.BuildingInspection),
|
|
24
26
|
searchables: ['name']
|
|
25
|
-
});
|
|
27
|
+
}).andWhere('project_type = :projectType', { projectType });
|
|
26
28
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
27
29
|
return { items, total };
|
|
28
30
|
}
|
|
@@ -37,6 +39,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
37
39
|
.innerJoin('projects', 'p', 'bc.id = p.building_complex_id')
|
|
38
40
|
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
39
41
|
.where('p.domain = :domain', { domain: domain.id })
|
|
42
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
40
43
|
.andWhere('p.id = :projectId', { projectId })
|
|
41
44
|
.orderBy('bi.created_at', 'DESC');
|
|
42
45
|
if (limit) {
|
|
@@ -45,16 +48,6 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
45
48
|
const [items, total] = await queryBuilder.getManyAndCount();
|
|
46
49
|
return { items, total };
|
|
47
50
|
}
|
|
48
|
-
async projectByBuildingLevelId(buildingLevelId, context) {
|
|
49
|
-
const queryBuilder = (0, shell_1.getRepository)(project_1.Project)
|
|
50
|
-
.createQueryBuilder('p')
|
|
51
|
-
.innerJoin('building_complexes', 'bc', 'p.building_complex_id = bc.id')
|
|
52
|
-
.innerJoin('buildings', 'b', 'b.building_complex_id = bc.id')
|
|
53
|
-
.innerJoin('building_levels', 'bl', 'bl.building_id = b.id')
|
|
54
|
-
.where('bl.id = :buildingLevelId', { buildingLevelId });
|
|
55
|
-
const result = await queryBuilder.getOne();
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
51
|
async buildingInspectionsOfBuildingLevel(params, context) {
|
|
59
52
|
const { buildingLevelId, limit } = params;
|
|
60
53
|
const queryBuilder = (0, shell_1.getRepository)(building_inspection_1.BuildingInspection)
|
|
@@ -62,6 +55,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
62
55
|
.innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
|
|
63
56
|
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
64
57
|
.where('bl.id = :buildingLevelId', { buildingLevelId })
|
|
58
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
65
59
|
.orderBy('bi.updated_at', 'DESC');
|
|
66
60
|
if (limit) {
|
|
67
61
|
queryBuilder.limit(limit);
|
|
@@ -78,6 +72,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
78
72
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
79
73
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
80
74
|
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
|
|
75
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
81
76
|
.groupBy('bi.building_level_id')
|
|
82
77
|
.getRawOne();
|
|
83
78
|
return {
|
|
@@ -98,6 +93,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
98
93
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
99
94
|
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
|
|
100
95
|
.andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })
|
|
96
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
101
97
|
.groupBy('bi.building_level_id')
|
|
102
98
|
.addGroupBy('bi.request_date')
|
|
103
99
|
.getRawMany();
|
|
@@ -112,6 +108,7 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
112
108
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
113
109
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
114
110
|
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })
|
|
111
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
115
112
|
.groupBy('bi.building_level_id')
|
|
116
113
|
.getRawOne();
|
|
117
114
|
return {
|
|
@@ -123,18 +120,19 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
123
120
|
}
|
|
124
121
|
async buildingInspectionSummaryOfProject(projectId, context) {
|
|
125
122
|
const { domain } = context.state;
|
|
126
|
-
const result = await (0, shell_1.getRepository)(
|
|
127
|
-
.createQueryBuilder('
|
|
123
|
+
const result = await (0, shell_1.getRepository)(building_inspection_1.BuildingInspection)
|
|
124
|
+
.createQueryBuilder('bi')
|
|
128
125
|
.select(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.WAIT}' OR bi.status='${building_inspection_1.BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`)
|
|
129
126
|
.addSelect(`COUNT(CASE WHEN bi.status='${building_inspection_1.BuildingInspectionStatus.REQUEST}' OR bi.status='${building_inspection_1.BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`)
|
|
130
127
|
.addSelect(`COUNT(CASE WHEN bi.status = '${building_inspection_1.BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
131
128
|
.addSelect(`COUNT(CASE WHEN bi.status = '${building_inspection_1.BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
132
|
-
.innerJoin('
|
|
133
|
-
.innerJoin('
|
|
134
|
-
.innerJoin('
|
|
135
|
-
.
|
|
129
|
+
.innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
|
|
130
|
+
.innerJoin('buildings', 'b', 'bl.building_id = b.id')
|
|
131
|
+
.innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')
|
|
132
|
+
.innerJoin('projects', 'p', 'bc.id = p.building_complex_id')
|
|
136
133
|
.where('p.domain = :domain', { domain: domain.id })
|
|
137
134
|
.andWhere('p.id = :projectId', { projectId })
|
|
135
|
+
.andWhere('bi.project_type = :projectType', { projectType })
|
|
138
136
|
.groupBy('p.id')
|
|
139
137
|
.getRawOne();
|
|
140
138
|
return {
|
|
@@ -159,7 +157,21 @@ let BuildingInspectionQuery = class BuildingInspectionQuery {
|
|
|
159
157
|
});
|
|
160
158
|
return attachment;
|
|
161
159
|
}
|
|
160
|
+
async manager(buildingInspection) {
|
|
161
|
+
const queryBuilder = (0, shell_1.getRepository)(auth_base_1.User)
|
|
162
|
+
.createQueryBuilder('u')
|
|
163
|
+
.select('m.id', 'id')
|
|
164
|
+
.addSelect('m.phone', 'phone')
|
|
165
|
+
.addSelect('m.position', 'position')
|
|
166
|
+
.addSelect('u.id', 'userId')
|
|
167
|
+
.addSelect('u.name', 'name')
|
|
168
|
+
.addSelect('u.updated_at', 'updatedAt')
|
|
169
|
+
.leftJoin('managers', 'm', 'u.id = m.user_id')
|
|
170
|
+
.where('u.id = :userId', { userId: buildingInspection.managerId });
|
|
171
|
+
return await queryBuilder.getRawOne();
|
|
172
|
+
}
|
|
162
173
|
};
|
|
174
|
+
exports.BuildingInspectionQuery = BuildingInspectionQuery;
|
|
163
175
|
tslib_1.__decorate([
|
|
164
176
|
(0, type_graphql_1.Query)(returns => building_inspection_1.BuildingInspection, { nullable: true, description: 'To fetch a BuildingInspection' }),
|
|
165
177
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
|
|
@@ -184,14 +196,6 @@ tslib_1.__decorate([
|
|
|
184
196
|
tslib_1.__metadata("design:paramtypes", [building_inspection_type_1.BuildingInspectionsOfProject, Object]),
|
|
185
197
|
tslib_1.__metadata("design:returntype", Promise)
|
|
186
198
|
], BuildingInspectionQuery.prototype, "buildingInspectionsOfProject", null);
|
|
187
|
-
tslib_1.__decorate([
|
|
188
|
-
(0, type_graphql_1.Query)(returns => project_1.Project, { description: 'To fetch Project' }),
|
|
189
|
-
tslib_1.__param(0, (0, type_graphql_1.Arg)('buildingLevelId')),
|
|
190
|
-
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
191
|
-
tslib_1.__metadata("design:type", Function),
|
|
192
|
-
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
193
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
194
|
-
], BuildingInspectionQuery.prototype, "projectByBuildingLevelId", null);
|
|
195
199
|
tslib_1.__decorate([
|
|
196
200
|
(0, type_graphql_1.Query)(returns => building_inspection_type_1.BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' }),
|
|
197
201
|
tslib_1.__param(0, (0, type_graphql_1.Arg)('params')),
|
|
@@ -254,8 +258,14 @@ tslib_1.__decorate([
|
|
|
254
258
|
tslib_1.__metadata("design:paramtypes", [building_inspection_1.BuildingInspection]),
|
|
255
259
|
tslib_1.__metadata("design:returntype", Promise)
|
|
256
260
|
], BuildingInspectionQuery.prototype, "attatchments", null);
|
|
257
|
-
|
|
261
|
+
tslib_1.__decorate([
|
|
262
|
+
(0, type_graphql_1.FieldResolver)(type => building_inspection_type_1.ProjectManagerOutput),
|
|
263
|
+
tslib_1.__param(0, (0, type_graphql_1.Root)()),
|
|
264
|
+
tslib_1.__metadata("design:type", Function),
|
|
265
|
+
tslib_1.__metadata("design:paramtypes", [building_inspection_1.BuildingInspection]),
|
|
266
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
267
|
+
], BuildingInspectionQuery.prototype, "manager", null);
|
|
268
|
+
exports.BuildingInspectionQuery = BuildingInspectionQuery = tslib_1.__decorate([
|
|
258
269
|
(0, type_graphql_1.Resolver)(building_inspection_1.BuildingInspection)
|
|
259
270
|
], BuildingInspectionQuery);
|
|
260
|
-
exports.BuildingInspectionQuery = BuildingInspectionQuery;
|
|
261
271
|
//# sourceMappingURL=building-inspection-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"building-inspection-query.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qEAA4D;AAC5D,iDAA+F;AAC/F,+DAAoF;AACpF,yEAKmC;AACnC,6DAAsD;AACtD,sDAAkD;AAClD,2CAAuC;AAGhC,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAE5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,EAAU,EAAS,OAAwB;QAC7E,OAAO,MAAM,IAAA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AkOnC;AAlOY,0DAAuB","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Arg, Args, Ctx } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { getRepository, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'\nimport { BuildingInspection, BuildingInspectionStatus } from './building-inspection'\nimport {\n BuildingInspectionList,\n BuildingInspectionsOfBuildingLevel,\n BuildingInspectionsOfProject,\n BuildingInspectionSummary\n} from './building-inspection-type'\nimport { BuildingLevel } from '@dssp/building-complex'\nimport { Checklist } from '../checklist/checklist'\nimport { Project } from '@dssp/project'\n\n@Resolver(BuildingInspection)\nexport class BuildingInspectionQuery {\n @Query(returns => BuildingInspection!, { nullable: true, description: 'To fetch a BuildingInspection' })\n async buildingInspection(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BuildingInspection> {\n return await getRepository(BuildingInspection).findOne({\n where: { id }\n })\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BuildingInspectionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(BuildingInspection),\n searchables: ['name']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspectionsOfProject(\n @Arg('params') params: BuildingInspectionsOfProject,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionList> {\n const { domain } = context.state\n const { projectId, limit } = params\n\n const queryBuilder = getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')\n .innerJoin('buildings', 'b', 'bl.building_id = b.id')\n .innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')\n .innerJoin('projects', 'p', 'bc.id = p.building_complex_id')\n .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')\n .where('p.domain = :domain', { domain: domain.id })\n .andWhere('p.id = :projectId', { projectId })\n .orderBy('bi.created_at', 'DESC')\n\n if (limit) {\n queryBuilder.limit(limit)\n }\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => Project!, { description: 'To fetch Project' })\n async projectByBuildingLevelId(\n @Arg('buildingLevelId') buildingLevelId: string,\n @Ctx() context: ResolverContext\n ): Promise<Project> {\n const queryBuilder = getRepository(Project)\n .createQueryBuilder('p')\n .innerJoin('building_complexes', 'bc', 'p.building_complex_id = bc.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\n const result = await queryBuilder.getOne()\n\n return result\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspectionsOfBuildingLevel(\n @Arg('params') params: BuildingInspectionsOfBuildingLevel,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionList> {\n const { buildingLevelId, limit } = params\n\n const queryBuilder = getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')\n .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')\n .where('bl.id = :buildingLevelId', { buildingLevelId })\n .orderBy('bi.updated_at', 'DESC')\n\n if (limit) {\n queryBuilder.limit(limit)\n }\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n // 층 별로 검수 개수 써머리\n @Query(returns => BuildingInspectionSummary!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })\n async buildingInspectionSummaryOfBuildingLevel(\n @Arg('buildingLevelId') buildingLevelId: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })\n .groupBy('bi.building_level_id')\n .getRawOne()\n\n return {\n wait: buildingInspectionSummary?.wait || 0,\n request: buildingInspectionSummary?.request || 0,\n pass: buildingInspectionSummary?.pass || 0,\n fail: buildingInspectionSummary?.fail || 0\n }\n }\n\n // 층 별로 검수 개수 써머리\n @Query(returns => [BuildingInspectionSummary]!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })\n async buildingInspectionDateSummaryOfLevelAndPeriod(\n @Arg('buildingLevelId') buildingLevelId: string,\n @Arg('startDate') startDate: string,\n @Arg('endDate') endDate: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary[]> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS \"requestDate\"`)\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })\n .andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })\n .groupBy('bi.building_level_id')\n .addGroupBy('bi.request_date')\n .getRawMany()\n\n return buildingInspectionSummary\n }\n\n // 층 별로 검수 개수 써머리\n @FieldResolver(type => BuildingInspectionSummary)\n async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })\n .groupBy('bi.building_level_id')\n .getRawOne()\n\n return {\n wait: buildingInspectionSummary?.wait || 0,\n request: buildingInspectionSummary?.request || 0,\n pass: buildingInspectionSummary?.pass || 0,\n fail: buildingInspectionSummary?.fail || 0\n }\n }\n\n @Query(returns => BuildingInspectionSummary, { description: '프로젝트의 검측상태 별 카운트' })\n async buildingInspectionSummaryOfProject(\n @Arg('projectId') projectId: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary> {\n const { domain } = context.state\n\n const result = await getRepository(Project)\n .createQueryBuilder('p')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .innerJoin('p.buildingComplex', 'bc')\n .innerJoin('bc.buildings', 'b')\n .innerJoin('b.buildingLevels', 'bl')\n .leftJoin('building_inspections', 'bi', 'bi.building_level_id = bl.id AND bi.deleted_at IS NULL')\n .where('p.domain = :domain', { domain: domain.id })\n .andWhere('p.id = :projectId', { projectId })\n .groupBy('p.id')\n .getRawOne()\n\n return {\n wait: result?.wait || 0,\n request: result?.request || 0,\n pass: result?.pass || 0,\n fail: result?.fail || 0\n }\n }\n\n @FieldResolver(type => Checklist)\n async checklist(@Root() buildingInspection: BuildingInspection): Promise<Checklist> {\n return await getRepository(Checklist).findOneBy({ id: buildingInspection.checklistId })\n }\n\n @FieldResolver(type => BuildingLevel)\n async buildingLevel(@Root() buildingInspection: BuildingInspection): Promise<BuildingLevel> {\n return await getRepository(BuildingLevel).findOneBy({ id: buildingInspection.buildingLevelId })\n }\n\n @FieldResolver(type => [Attachment])\n async attatchments(@Root() buildingInspection: BuildingInspection): Promise<Attachment[] | undefined> {\n const attachment: Attachment[] = await getRepository(Attachment).find({\n where: {\n refType: BuildingInspection.name,\n refBy: buildingInspection.id\n }\n })\n return attachment\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"building-inspection-query.js","sourceRoot":"","sources":["../../../server/service/building-inspection/building-inspection-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qEAA4D;AAC5D,iDAA+F;AAC/F,+DAAiG;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a;;wEAsBnE;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,oDAAyB,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAE9E,mBAAA,IAAA,kBAAG,EAAC,WAAW,CAAC,CAAA;IAChB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iFA8BP;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,qBAAS,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;wDAE7D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gCAAa,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;4DAEjE;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAU,CAAC,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;2DAShE;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,+CAAoB,CAAC;IAC7B,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAa3D;kCAvOU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAwOnC","sourcesContent":["import { Resolver, Query, FieldResolver, Root, Arg, Args, Ctx } from 'type-graphql'\nimport { Attachment } from '@things-factory/attachment-base'\nimport { getRepository, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'\nimport { BuildingInspection, BuildingInspectionStatus, ProjectType } from './building-inspection'\nimport {\n BuildingInspectionList,\n BuildingInspectionsOfBuildingLevel,\n BuildingInspectionsOfProject,\n BuildingInspectionSummary,\n ProjectManagerOutput\n} from './building-inspection-type'\nimport { BuildingLevel } from '@dssp/building-complex'\nimport { Checklist } from '../checklist/checklist'\nimport { config } from '@things-factory/env'\nimport { User } from '@things-factory/auth-base'\n\nconst projectType = config.get('projectType', ProjectType.DSSP)\n\n@Resolver(BuildingInspection)\nexport class BuildingInspectionQuery {\n @Query(returns => BuildingInspection!, { nullable: true, description: 'To fetch a BuildingInspection' })\n async buildingInspection(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BuildingInspection> {\n return await getRepository(BuildingInspection).findOne({\n where: { id, projectType }\n })\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BuildingInspectionList> {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n params,\n repository: await getRepository(BuildingInspection),\n searchables: ['name']\n }).andWhere('project_type = :projectType', { projectType })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspectionsOfProject(\n @Arg('params') params: BuildingInspectionsOfProject,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionList> {\n const { domain } = context.state\n const { projectId, limit } = params\n\n const queryBuilder = getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')\n .innerJoin('buildings', 'b', 'bl.building_id = b.id')\n .innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')\n .innerJoin('projects', 'p', 'bc.id = p.building_complex_id')\n .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')\n .where('p.domain = :domain', { domain: domain.id })\n .andWhere('bi.project_type = :projectType', { projectType })\n .andWhere('p.id = :projectId', { projectId })\n .orderBy('bi.created_at', 'DESC')\n\n if (limit) {\n queryBuilder.limit(limit)\n }\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })\n async buildingInspectionsOfBuildingLevel(\n @Arg('params') params: BuildingInspectionsOfBuildingLevel,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionList> {\n const { buildingLevelId, limit } = params\n\n const queryBuilder = getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')\n .innerJoin('checklists', 'c', 'bi.checklist_id = c.id')\n .where('bl.id = :buildingLevelId', { buildingLevelId })\n .andWhere('bi.project_type = :projectType', { projectType })\n .orderBy('bi.updated_at', 'DESC')\n\n if (limit) {\n queryBuilder.limit(limit)\n }\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n // 층 별로 검수 개수 써머리\n @Query(returns => BuildingInspectionSummary!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })\n async buildingInspectionSummaryOfBuildingLevel(\n @Arg('buildingLevelId') buildingLevelId: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })\n .andWhere('bi.project_type = :projectType', { projectType })\n .groupBy('bi.building_level_id')\n .getRawOne()\n\n return {\n wait: buildingInspectionSummary?.wait || 0,\n request: buildingInspectionSummary?.request || 0,\n pass: buildingInspectionSummary?.pass || 0,\n fail: buildingInspectionSummary?.fail || 0\n }\n }\n\n // 층 별로 검수 개수 써머리\n @Query(returns => [BuildingInspectionSummary]!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })\n async buildingInspectionDateSummaryOfLevelAndPeriod(\n @Arg('buildingLevelId') buildingLevelId: string,\n @Arg('startDate') startDate: string,\n @Arg('endDate') endDate: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary[]> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS \"requestDate\"`)\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })\n .andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })\n .andWhere('bi.project_type = :projectType', { projectType })\n .groupBy('bi.building_level_id')\n .addGroupBy('bi.request_date')\n .getRawMany()\n\n return buildingInspectionSummary\n }\n\n // 층 별로 검수 개수 써머리\n @FieldResolver(type => BuildingInspectionSummary)\n async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {\n const buildingInspectionSummary = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })\n .andWhere('bi.project_type = :projectType', { projectType })\n .groupBy('bi.building_level_id')\n .getRawOne()\n\n return {\n wait: buildingInspectionSummary?.wait || 0,\n request: buildingInspectionSummary?.request || 0,\n pass: buildingInspectionSummary?.pass || 0,\n fail: buildingInspectionSummary?.fail || 0\n }\n }\n\n @Query(returns => BuildingInspectionSummary, { description: '프로젝트의 검측상태 별 카운트' })\n async buildingInspectionSummaryOfProject(\n @Arg('projectId') projectId: string,\n @Ctx() context: ResolverContext\n ): Promise<BuildingInspectionSummary> {\n const { domain } = context.state\n\n const result = await getRepository(BuildingInspection)\n .createQueryBuilder('bi')\n .select(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`\n )\n .addSelect(\n `COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`\n )\n .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)\n .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)\n .innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')\n .innerJoin('buildings', 'b', 'bl.building_id = b.id')\n .innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')\n .innerJoin('projects', 'p', 'bc.id = p.building_complex_id')\n .where('p.domain = :domain', { domain: domain.id })\n .andWhere('p.id = :projectId', { projectId })\n .andWhere('bi.project_type = :projectType', { projectType })\n .groupBy('p.id')\n .getRawOne()\n\n return {\n wait: result?.wait || 0,\n request: result?.request || 0,\n pass: result?.pass || 0,\n fail: result?.fail || 0\n }\n }\n\n @FieldResolver(type => Checklist)\n async checklist(@Root() buildingInspection: BuildingInspection): Promise<Checklist> {\n return await getRepository(Checklist).findOneBy({ id: buildingInspection.checklistId })\n }\n\n @FieldResolver(type => BuildingLevel)\n async buildingLevel(@Root() buildingInspection: BuildingInspection): Promise<BuildingLevel> {\n return await getRepository(BuildingLevel).findOneBy({ id: buildingInspection.buildingLevelId })\n }\n\n @FieldResolver(type => [Attachment])\n async attatchments(@Root() buildingInspection: BuildingInspection): Promise<Attachment[] | undefined> {\n const attachment: Attachment[] = await getRepository(Attachment).find({\n where: {\n refType: BuildingInspection.name,\n refBy: buildingInspection.id\n }\n })\n\n return attachment\n }\n\n @FieldResolver(type => ProjectManagerOutput)\n async manager(@Root() buildingInspection: BuildingInspection): Promise<ProjectManagerOutput> {\n const queryBuilder = getRepository(User)\n .createQueryBuilder('u')\n .select('m.id', 'id')\n .addSelect('m.phone', 'phone')\n .addSelect('m.position', 'position')\n .addSelect('u.id', 'userId')\n .addSelect('u.name', 'name')\n .addSelect('u.updated_at', 'updatedAt')\n .leftJoin('managers', 'm', 'u.id = m.user_id')\n .where('u.id = :userId', { userId: buildingInspection.managerId })\n\n return await queryBuilder.getRawOne()\n }\n}\n"]}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { BuildingInspection } from './building-inspection';
|
|
2
|
-
declare class ChecklistInputType {
|
|
2
|
+
export declare class ChecklistInputType {
|
|
3
3
|
name: string;
|
|
4
|
-
constructionType
|
|
5
|
-
constructionDetailType
|
|
4
|
+
constructionType?: string;
|
|
5
|
+
constructionDetailType?: string;
|
|
6
6
|
location?: string;
|
|
7
7
|
inspectionDrawingType?: string;
|
|
8
8
|
inspectionParts?: string[];
|
|
9
9
|
}
|
|
10
|
-
declare class ChecklistItemInputType {
|
|
10
|
+
export declare class ChecklistItemInputType {
|
|
11
11
|
name: string;
|
|
12
12
|
mainType: string;
|
|
13
13
|
detailType: string;
|
|
14
14
|
inspctionCriteria: string;
|
|
15
15
|
}
|
|
16
16
|
export declare class NewBuildingInspection {
|
|
17
|
-
buildingLevelId
|
|
17
|
+
buildingLevelId?: string;
|
|
18
18
|
checklist: ChecklistInputType;
|
|
19
19
|
checklistItem: ChecklistItemInputType[];
|
|
20
|
+
cellX?: number;
|
|
21
|
+
cellY?: number;
|
|
22
|
+
managerId?: string;
|
|
20
23
|
}
|
|
21
|
-
declare class ChecklistSubmitInputType {
|
|
24
|
+
export declare class ChecklistSubmitInputType {
|
|
22
25
|
id: string;
|
|
23
26
|
overallConstructorSignature?: string;
|
|
24
27
|
taskConstructorSignature?: string;
|
|
25
28
|
overallSupervisorySignature?: string;
|
|
26
29
|
taskSupervisorySignature?: string;
|
|
27
30
|
}
|
|
28
|
-
declare class ChecklistItemSubmitInputType {
|
|
31
|
+
export declare class ChecklistItemSubmitInputType {
|
|
29
32
|
id: string;
|
|
30
33
|
constructionConfirmStatus?: string;
|
|
31
34
|
supervisoryConfirmStatus?: string;
|
|
@@ -58,4 +61,11 @@ export declare class BuildingInspectionList {
|
|
|
58
61
|
items: BuildingInspection[];
|
|
59
62
|
total: number;
|
|
60
63
|
}
|
|
61
|
-
export {
|
|
64
|
+
export declare class ProjectManagerOutput {
|
|
65
|
+
id?: string;
|
|
66
|
+
phone?: string;
|
|
67
|
+
position?: string;
|
|
68
|
+
userId?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
updatedAt?: string;
|
|
71
|
+
}
|