@dssp/supervision 1.0.0-alpha.0 → 1.0.0-alpha.14
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/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 +1 -1
- 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 +2 -2
- package/dist-client/pages/building-inspection/building-inspection-list.js +2 -1
- 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.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 +8 -5
- 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 +930 -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 +736 -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.map +1 -1
- package/dist-client/pages/checklist/checklist-view.d.ts +6 -0
- package/dist-client/pages/checklist/checklist-view.js +291 -185
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- 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 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js +91 -14
- 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 -1
- package/dist-server/service/building-inspection/building-inspection-query.js +33 -4
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +10 -3
- package/dist-server/service/building-inspection/building-inspection-type.js +45 -20
- 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 +2 -4
- package/dist-server/service/building-inspection/index.js +2 -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.js +2 -2
- 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.js +6 -6
- package/dist-server/service/checklist/checklist-type.js.map +1 -1
- package/dist-server/service/checklist/checklist.d.ts +19 -1
- package/dist-server/service/checklist/checklist.js +78 -7
- 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.js +2 -2
- 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 +0 -1
- package/dist-server/service/index.js +1 -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.js +3 -3
- 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 +13 -13
- package/things-factory.config.js +3 -1
- package/client/bootstrap.ts +0 -1
- package/client/index.ts +0 -0
- package/client/pages/action-plan/action-plan-importer.ts +0 -94
- package/client/pages/action-plan/action-plan-list-page.ts +0 -340
- package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
- package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
- package/client/pages/building-inspection/building-inspection-list.ts +0 -565
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
- package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
- package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
- package/client/pages/checklist/attachment-list-popup.ts +0 -301
- package/client/pages/checklist/checklist-view.ts +0 -581
- package/client/pages/checklist/comment-list-popup.ts +0 -328
- package/client/pages/checklist/file-preview-popup.ts +0 -70
- package/client/pages/checklist-template/checklist-template-item.ts +0 -240
- package/client/pages/checklist-template/checklist-template-list.ts +0 -368
- package/client/pages/checklist-template/checklist-type-management.ts +0 -262
- package/client/pages/issue/issue-importer.ts +0 -94
- package/client/pages/issue/issue-list-page.ts +0 -340
- package/client/pages/project-report/project-report-importer.ts +0 -94
- package/client/pages/project-report/project-report-list-page.ts +0 -340
- package/client/pages/supervisor/supervisor-importer.ts +0 -94
- package/client/pages/supervisor/supervisor-list-page.ts +0 -340
- package/client/route.ts +0 -27
- package/client/tsconfig.json +0 -11
- 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
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +0 -4
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -28
- package/server/service/action-plan/action-plan-mutation.ts +0 -198
- package/server/service/action-plan/action-plan-query.ts +0 -62
- package/server/service/action-plan/action-plan-type.ts +0 -61
- package/server/service/action-plan/action-plan.ts +0 -103
- package/server/service/action-plan/index.ts +0 -7
- package/server/service/building-inspection/building-inspection-history.ts +0 -72
- package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
- package/server/service/building-inspection/building-inspection-query.ts +0 -242
- package/server/service/building-inspection/building-inspection-type.ts +0 -145
- package/server/service/building-inspection/building-inspection.ts +0 -108
- package/server/service/building-inspection/event-subscriber.ts +0 -20
- package/server/service/building-inspection/index.ts +0 -11
- package/server/service/checklist/checklist-history.ts +0 -96
- package/server/service/checklist/checklist-mutation.ts +0 -103
- package/server/service/checklist/checklist-query.ts +0 -58
- package/server/service/checklist/checklist-type.ts +0 -49
- package/server/service/checklist/checklist.ts +0 -127
- package/server/service/checklist/event-subscriber.ts +0 -17
- package/server/service/checklist/index.ts +0 -9
- package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
- package/server/service/checklist-item/checklist-item-query.ts +0 -84
- package/server/service/checklist-item/checklist-item-type.ts +0 -12
- package/server/service/checklist-item/checklist-item.ts +0 -103
- package/server/service/checklist-item/index.ts +0 -7
- package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
- package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
- package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
- package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
- package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
- package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
- package/server/service/checklist-item-comment/index.ts +0 -9
- package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
- package/server/service/checklist-template/checklist-template-query.ts +0 -39
- package/server/service/checklist-template/checklist-template-type.ts +0 -23
- package/server/service/checklist-template/checklist-template.ts +0 -71
- package/server/service/checklist-template/index.ts +0 -6
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
- package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
- package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
- package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
- package/server/service/checklist-template-item/index.ts +0 -6
- package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
- package/server/service/checklist-type/checklist-type-query.ts +0 -39
- package/server/service/checklist-type/checklist-type-type.ts +0 -26
- package/server/service/checklist-type/checklist-type.ts +0 -64
- package/server/service/checklist-type/index.ts +0 -6
- package/server/service/index.ts +0 -88
- package/server/service/issue/index.ts +0 -7
- package/server/service/issue/issue-mutation.ts +0 -198
- package/server/service/issue/issue-query.ts +0 -62
- package/server/service/issue/issue-type.ts +0 -61
- package/server/service/issue/issue.ts +0 -100
- package/server/service/project-report/index.ts +0 -7
- package/server/service/project-report/project-report-mutation.ts +0 -198
- package/server/service/project-report/project-report-query.ts +0 -62
- package/server/service/project-report/project-report-type.ts +0 -61
- package/server/service/project-report/project-report.ts +0 -113
- package/server/service/supervisor/index.ts +0 -7
- package/server/service/supervisor/supervisor-mutation.ts +0 -198
- package/server/service/supervisor/supervisor-query.ts +0 -62
- package/server/service/supervisor/supervisor-type.ts +0 -61
- package/server/service/supervisor/supervisor.ts +0 -108
- package/server/tsconfig.json +0 -10
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { BuildingInspection } from './building-inspection'
|
|
4
|
-
import {
|
|
5
|
-
NewBuildingInspection,
|
|
6
|
-
UpdateBuildingInspectionDrawingMarker,
|
|
7
|
-
UpdateBuildingInspectionSubmitType
|
|
8
|
-
} from './building-inspection-type'
|
|
9
|
-
import { BuildingInspectionStatus } from './building-inspection'
|
|
10
|
-
import { Checklist } from '../checklist/checklist'
|
|
11
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
12
|
-
import { getRepository } from '@things-factory/shell'
|
|
13
|
-
import { BuildingLevel } from '@dssp/building-complex'
|
|
14
|
-
|
|
15
|
-
@Resolver(BuildingInspection)
|
|
16
|
-
export class BuildingInspectionMutation {
|
|
17
|
-
@Directive('@transaction')
|
|
18
|
-
@Mutation(returns => BuildingInspection, { description: 'To create Building Inspection information' })
|
|
19
|
-
async createBuildingInspection(
|
|
20
|
-
@Arg('patch') patch: NewBuildingInspection,
|
|
21
|
-
@Ctx() context: ResolverContext
|
|
22
|
-
): Promise<BuildingInspection> {
|
|
23
|
-
const { user, tx } = context.state
|
|
24
|
-
const { buildingLevelId, checklist, checklistItem } = patch
|
|
25
|
-
const buildingInspectionRepository = tx.getRepository(BuildingInspection)
|
|
26
|
-
const checklistRepository = tx.getRepository(Checklist)
|
|
27
|
-
const checklistItemRepository = tx.getRepository(ChecklistItem)
|
|
28
|
-
|
|
29
|
-
// 1. 벨리데이션
|
|
30
|
-
if (!buildingLevelId) throw new Error('층 아이디가 없습니다.')
|
|
31
|
-
if (!checklist.name) throw new Error('체크리스트 이름이 없습니다.')
|
|
32
|
-
if (!checklist.constructionType) throw new Error('공종 타입이 없습니다.')
|
|
33
|
-
if (!checklist.constructionDetailType) throw new Error('상세 공종 타입이 없습니다.')
|
|
34
|
-
if (!checklist.location) throw new Error('위치가 없습니다.')
|
|
35
|
-
if (!checklist.inspectionDrawingType) throw new Error('검측 도면 타입이 없습니다.')
|
|
36
|
-
if (checklist.inspectionParts.length === 0) throw new Error('검측 부위가 없습니다.')
|
|
37
|
-
if (checklistItem.length === 0) throw new Error('체크리스트 아이템이 없습니다.')
|
|
38
|
-
|
|
39
|
-
// 2. checklist 저장
|
|
40
|
-
const documentNo = await this.getRecentDocumentNoByBuildingLevelId(buildingLevelId)
|
|
41
|
-
const savedChecklist = await checklistRepository.save({
|
|
42
|
-
...checklist,
|
|
43
|
-
documentNo,
|
|
44
|
-
creator: user,
|
|
45
|
-
updater: user
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
// 3. checklistItem 저장
|
|
49
|
-
const checklistItems = checklistItem.map((item, idx) => ({
|
|
50
|
-
name: item.name,
|
|
51
|
-
mainType: item.mainType,
|
|
52
|
-
detailType: item.detailType,
|
|
53
|
-
inspctionCriteria: item.inspctionCriteria,
|
|
54
|
-
sequence: idx,
|
|
55
|
-
checklist: savedChecklist,
|
|
56
|
-
creator: user,
|
|
57
|
-
updater: user
|
|
58
|
-
}))
|
|
59
|
-
await checklistItemRepository.save(checklistItems)
|
|
60
|
-
|
|
61
|
-
// 4. buildingInspection 저장
|
|
62
|
-
const result = await buildingInspectionRepository.save({
|
|
63
|
-
status: BuildingInspectionStatus.WAIT,
|
|
64
|
-
buildingLevel: { id: buildingLevelId },
|
|
65
|
-
checklist: savedChecklist,
|
|
66
|
-
creator: user,
|
|
67
|
-
updater: user
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
return result
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 검측 상태 변경 & 체크리스트 갱신
|
|
74
|
-
@Directive('@transaction')
|
|
75
|
-
@Mutation(returns => Boolean, { description: 'To create Building Inspection And Checklist information' })
|
|
76
|
-
async updateBuildingInspectionChecklist(
|
|
77
|
-
@Arg('buildingInspection') buildingInspection: UpdateBuildingInspectionSubmitType,
|
|
78
|
-
@Ctx() context: ResolverContext
|
|
79
|
-
): Promise<boolean> {
|
|
80
|
-
const { user, tx } = context.state
|
|
81
|
-
const { id: buildingInspectionId, checklist, checklistItem } = buildingInspection
|
|
82
|
-
const buildingInspectionRepo = tx.getRepository(BuildingInspection)
|
|
83
|
-
const checklistRepo = tx.getRepository(Checklist)
|
|
84
|
-
const checklistItemRepo = tx.getRepository(ChecklistItem)
|
|
85
|
-
const oldBuildingInspection = await buildingInspectionRepo.findOneBy({ id: buildingInspectionId })
|
|
86
|
-
const status = oldBuildingInspection.status
|
|
87
|
-
const isConstructor: boolean =
|
|
88
|
-
status == BuildingInspectionStatus.WAIT ||
|
|
89
|
-
status == BuildingInspectionStatus.OVERALL_WAIT ||
|
|
90
|
-
status == BuildingInspectionStatus.FAIL
|
|
91
|
-
let inspectionStatus = null
|
|
92
|
-
|
|
93
|
-
// 1. 벨리데이션
|
|
94
|
-
if (!buildingInspectionId) throw new Error('검측 아이디가 없습니다.')
|
|
95
|
-
if (!status) throw new Error('검측 상태가 없습니다.')
|
|
96
|
-
if (status == BuildingInspectionStatus.PASS) throw new Error('검측 상태가 수정할 수 있는 상태가 아닙니다.')
|
|
97
|
-
|
|
98
|
-
if (isConstructor) {
|
|
99
|
-
// 시공자 타입별 밸리데이션
|
|
100
|
-
if (checklistItem.length !== checklistItem.filter(v => v.constructionConfirmStatus).length) {
|
|
101
|
-
throw new Error('아이템을 모두 체크해야 합니다.')
|
|
102
|
-
}
|
|
103
|
-
if (status == BuildingInspectionStatus.OVERALL_WAIT && !checklist.overallConstructorSignature) {
|
|
104
|
-
throw new Error('총괄 시공책임자 사인이 없습니다.')
|
|
105
|
-
}
|
|
106
|
-
if (status == BuildingInspectionStatus.WAIT && !checklist.taskConstructorSignature) {
|
|
107
|
-
throw new Error('공종별 시공관리자 사인이 없습니다.')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 시공자 상태 데이터
|
|
111
|
-
const isPassed = checklistItem.length === checklistItem.filter(v => v.constructionConfirmStatus === 'T').length
|
|
112
|
-
|
|
113
|
-
if (!isPassed) {
|
|
114
|
-
// 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화
|
|
115
|
-
inspectionStatus = BuildingInspectionStatus.FAIL
|
|
116
|
-
checklist.overallConstructorSignature = null
|
|
117
|
-
checklist.taskConstructorSignature = null
|
|
118
|
-
} else if (isPassed && (status === BuildingInspectionStatus.WAIT || status === BuildingInspectionStatus.FAIL)) {
|
|
119
|
-
// 2. 검측이 합격이면서 공종 시공자 스탭 = 상태는 총괄 시공자 스탭으로
|
|
120
|
-
inspectionStatus = BuildingInspectionStatus.OVERALL_WAIT
|
|
121
|
-
} else if (isPassed && status === BuildingInspectionStatus.OVERALL_WAIT) {
|
|
122
|
-
// 3. 검측이 합격이면서 총괄 시공자 스탭 = 상태는 공종 감리자 스탭으로, 감리자 싸인은 모두 초기화
|
|
123
|
-
inspectionStatus = BuildingInspectionStatus.REQUEST
|
|
124
|
-
checklist.overallSupervisorySignature = null
|
|
125
|
-
checklist.taskSupervisorySignature = null
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
// 감리자 타입별 밸리데이션
|
|
129
|
-
if (checklistItem.length !== checklistItem.filter(v => v.supervisoryConfirmStatus).length) {
|
|
130
|
-
throw new Error('아이템을 모두 체크해야 합니다.')
|
|
131
|
-
}
|
|
132
|
-
if (status == BuildingInspectionStatus.OVERALL_REQUEST && !checklist.overallSupervisorySignature) {
|
|
133
|
-
throw new Error('총괄 감리책임자 사인이 없습니다.')
|
|
134
|
-
}
|
|
135
|
-
if (status == BuildingInspectionStatus.REQUEST && !checklist.taskSupervisorySignature) {
|
|
136
|
-
throw new Error('공종별 감리 책임자 사인이 없습니다.')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// 감리자 상태 데이터
|
|
140
|
-
const isPassed = checklistItem.length === checklistItem.filter(v => v.supervisoryConfirmStatus === 'T').length
|
|
141
|
-
if (!isPassed) {
|
|
142
|
-
// 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화
|
|
143
|
-
inspectionStatus = BuildingInspectionStatus.FAIL
|
|
144
|
-
checklist.overallConstructorSignature = null
|
|
145
|
-
checklist.taskConstructorSignature = null
|
|
146
|
-
} else if (isPassed && status === BuildingInspectionStatus.REQUEST) {
|
|
147
|
-
// 2. 검측이 합격이면서 공종 감리자 스탭 = 상태는 총괄 감리자 스탭으로
|
|
148
|
-
inspectionStatus = BuildingInspectionStatus.OVERALL_REQUEST
|
|
149
|
-
} else if (isPassed && status === BuildingInspectionStatus.OVERALL_REQUEST) {
|
|
150
|
-
// 3. 검측이 합격이면서 총괄 감리자 스탭 = 상태는 합격으로
|
|
151
|
-
inspectionStatus = BuildingInspectionStatus.PASS
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 2. buildingInspection 저장
|
|
156
|
-
await buildingInspectionRepo.save({
|
|
157
|
-
...oldBuildingInspection,
|
|
158
|
-
status: inspectionStatus,
|
|
159
|
-
updater: user
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
// 3. checklist 저장
|
|
163
|
-
const oldChecklist = await checklistRepo.findOneBy({ id: checklist.id })
|
|
164
|
-
const inspectionDateField = isConstructor ? 'constructionInspectionDate' : 'supervisorInspectionDate'
|
|
165
|
-
await checklistRepo.save({
|
|
166
|
-
...oldChecklist,
|
|
167
|
-
[inspectionDateField]: new Date(),
|
|
168
|
-
overallConstructorSignature: checklist.overallConstructorSignature,
|
|
169
|
-
taskConstructorSignature: checklist.taskConstructorSignature,
|
|
170
|
-
overallSupervisorySignature: checklist.overallSupervisorySignature,
|
|
171
|
-
taskSupervisorySignature: checklist.taskSupervisorySignature,
|
|
172
|
-
updater: user
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
// 4. checklistItem 저장
|
|
176
|
-
for (let item of checklistItem) {
|
|
177
|
-
const confirmStatusField = isConstructor ? 'constructionConfirmStatus' : 'supervisoryConfirmStatus'
|
|
178
|
-
await checklistItemRepo.update(item.id, {
|
|
179
|
-
[confirmStatusField]: item[confirmStatusField],
|
|
180
|
-
updater: user
|
|
181
|
-
})
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return true
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@Directive('@transaction')
|
|
188
|
-
@Mutation(returns => BuildingInspection, { description: 'To update Building Inspection information' })
|
|
189
|
-
async updateBuildingInspection(
|
|
190
|
-
@Arg('patch') patch: UpdateBuildingInspectionDrawingMarker,
|
|
191
|
-
@Ctx() context: ResolverContext
|
|
192
|
-
): Promise<BuildingInspection> {
|
|
193
|
-
const { user, tx } = context.state
|
|
194
|
-
const buildingInspectionRepo = tx.getRepository(BuildingInspection)
|
|
195
|
-
|
|
196
|
-
// 벨리데이션
|
|
197
|
-
if (!patch.id) throw new Error('검측 아이디가 없습니다.')
|
|
198
|
-
|
|
199
|
-
const buildingInspection = await buildingInspectionRepo.findOneBy({ id: patch.id })
|
|
200
|
-
|
|
201
|
-
// 완료 상태인 검측데이터면 삭제 못함
|
|
202
|
-
if (buildingInspection.status === BuildingInspectionStatus.PASS) {
|
|
203
|
-
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const result = await buildingInspectionRepo.save({
|
|
207
|
-
...buildingInspection,
|
|
208
|
-
...patch,
|
|
209
|
-
updater: user
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
return result
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
@Directive('@transaction')
|
|
216
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple Checklists' })
|
|
217
|
-
async deleteBuildingInspections(
|
|
218
|
-
@Arg('ids', type => [String]) ids: string[],
|
|
219
|
-
@Ctx() context: ResolverContext
|
|
220
|
-
): Promise<boolean> {
|
|
221
|
-
const { tx } = context.state
|
|
222
|
-
const buildingInspectionRepository = tx.getRepository(BuildingInspection)
|
|
223
|
-
const checklistRepository = tx.getRepository(Checklist)
|
|
224
|
-
const checklistItemRepository = tx.getRepository(ChecklistItem)
|
|
225
|
-
|
|
226
|
-
const buildingInspections = await buildingInspectionRepository.createQueryBuilder('bi').whereInIds(ids).getMany()
|
|
227
|
-
|
|
228
|
-
// 완료 상태인 검측데이터가 한개라도 있으면 삭제 못함
|
|
229
|
-
if (buildingInspections.filter(bi => bi.status === BuildingInspectionStatus.PASS).length > 0) {
|
|
230
|
-
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// 검측 데이터 제거
|
|
234
|
-
await buildingInspectionRepository.softDelete({
|
|
235
|
-
id: In(ids)
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
// 검측 데이터의 체크 리스트 제거
|
|
239
|
-
const checklistIds = buildingInspections.map(bi => bi.checklistId)
|
|
240
|
-
await checklistRepository.softDelete({
|
|
241
|
-
id: In(checklistIds)
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
// 검측 데이터의 체크 리스트 아이템 제거
|
|
245
|
-
await checklistItemRepository
|
|
246
|
-
.createQueryBuilder()
|
|
247
|
-
.softDelete()
|
|
248
|
-
.where('checklist_id IN (:...checklistIds)', { checklistIds })
|
|
249
|
-
.execute()
|
|
250
|
-
|
|
251
|
-
return true
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
async getRecentDocumentNoByBuildingLevelId(buildingLevelId: string): Promise<string> {
|
|
255
|
-
const buildingLevel = await getRepository(BuildingLevel).findOne({
|
|
256
|
-
where: { id: buildingLevelId },
|
|
257
|
-
relations: ['building']
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
const buildingName = buildingLevel.building.name.match(/\d+/g)?.join('')?.padStart(4, '0') || '0000'
|
|
261
|
-
const floorName = buildingLevel.floor.toString().padStart(3, '0')
|
|
262
|
-
const latestChecklist = await getRepository(Checklist)
|
|
263
|
-
.createQueryBuilder('c')
|
|
264
|
-
.where('c.document_no LIKE :pattern', { pattern: `${buildingName}-${floorName}-%` })
|
|
265
|
-
.orderBy('c.created_at', 'DESC')
|
|
266
|
-
.getOne()
|
|
267
|
-
|
|
268
|
-
let documentNo = '000001'
|
|
269
|
-
if (latestChecklist) {
|
|
270
|
-
const lastNo = latestChecklist.documentNo.split('-')[2]
|
|
271
|
-
documentNo = (Number(lastNo) + 1).toString().padStart(6, '0')
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return `${buildingName}-${floorName}-${documentNo}`
|
|
275
|
-
}
|
|
276
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Arg, Args, Ctx } from 'type-graphql'
|
|
2
|
-
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
-
import { getRepository, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
|
|
4
|
-
import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
|
|
5
|
-
import {
|
|
6
|
-
BuildingInspectionList,
|
|
7
|
-
BuildingInspectionsOfBuildingLevel,
|
|
8
|
-
BuildingInspectionsOfProject,
|
|
9
|
-
BuildingInspectionSummary
|
|
10
|
-
} from './building-inspection-type'
|
|
11
|
-
import { BuildingLevel } from '@dssp/building-complex'
|
|
12
|
-
import { Checklist } from '../checklist/checklist'
|
|
13
|
-
import { Project } from '@dssp/project'
|
|
14
|
-
|
|
15
|
-
@Resolver(BuildingInspection)
|
|
16
|
-
export class BuildingInspectionQuery {
|
|
17
|
-
@Query(returns => BuildingInspection!, { nullable: true, description: 'To fetch a BuildingInspection' })
|
|
18
|
-
async buildingInspection(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<BuildingInspection> {
|
|
19
|
-
return await getRepository(BuildingInspection).findOne({
|
|
20
|
-
where: { id }
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
|
|
25
|
-
async buildingInspections(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<BuildingInspectionList> {
|
|
26
|
-
const { domain } = context.state
|
|
27
|
-
|
|
28
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
29
|
-
params,
|
|
30
|
-
repository: await getRepository(BuildingInspection),
|
|
31
|
-
searchables: ['name']
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
35
|
-
|
|
36
|
-
return { items, total }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
|
|
40
|
-
async buildingInspectionsOfProject(
|
|
41
|
-
@Arg('params') params: BuildingInspectionsOfProject,
|
|
42
|
-
@Ctx() context: ResolverContext
|
|
43
|
-
): Promise<BuildingInspectionList> {
|
|
44
|
-
const { domain } = context.state
|
|
45
|
-
const { projectId, limit } = params
|
|
46
|
-
|
|
47
|
-
const queryBuilder = getRepository(BuildingInspection)
|
|
48
|
-
.createQueryBuilder('bi')
|
|
49
|
-
.innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
|
|
50
|
-
.innerJoin('buildings', 'b', 'bl.building_id = b.id')
|
|
51
|
-
.innerJoin('building_complexes', 'bc', 'b.building_complex_id = bc.id')
|
|
52
|
-
.innerJoin('projects', 'p', 'bc.id = p.building_complex_id')
|
|
53
|
-
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
54
|
-
.where('p.domain = :domain', { domain: domain.id })
|
|
55
|
-
.andWhere('p.id = :projectId', { projectId })
|
|
56
|
-
.orderBy('bi.created_at', 'DESC')
|
|
57
|
-
|
|
58
|
-
if (limit) {
|
|
59
|
-
queryBuilder.limit(limit)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
63
|
-
|
|
64
|
-
return { items, total }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@Query(returns => Project!, { description: 'To fetch Project' })
|
|
68
|
-
async projectByBuildingLevelId(
|
|
69
|
-
@Arg('buildingLevelId') buildingLevelId: string,
|
|
70
|
-
@Ctx() context: ResolverContext
|
|
71
|
-
): Promise<Project> {
|
|
72
|
-
const queryBuilder = getRepository(Project)
|
|
73
|
-
.createQueryBuilder('p')
|
|
74
|
-
.innerJoin('building_complexes', 'bc', 'p.building_complex_id = bc.id')
|
|
75
|
-
.innerJoin('buildings', 'b', 'b.building_complex_id = bc.id')
|
|
76
|
-
.innerJoin('building_levels', 'bl', 'bl.building_id = b.id')
|
|
77
|
-
.where('bl.id = :buildingLevelId', { buildingLevelId })
|
|
78
|
-
|
|
79
|
-
const result = await queryBuilder.getOne()
|
|
80
|
-
|
|
81
|
-
return result
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@Query(returns => BuildingInspectionList, { description: 'To fetch multiple BuildingInspections' })
|
|
85
|
-
async buildingInspectionsOfBuildingLevel(
|
|
86
|
-
@Arg('params') params: BuildingInspectionsOfBuildingLevel,
|
|
87
|
-
@Ctx() context: ResolverContext
|
|
88
|
-
): Promise<BuildingInspectionList> {
|
|
89
|
-
const { buildingLevelId, limit } = params
|
|
90
|
-
|
|
91
|
-
const queryBuilder = getRepository(BuildingInspection)
|
|
92
|
-
.createQueryBuilder('bi')
|
|
93
|
-
.innerJoin('building_levels', 'bl', 'bi.building_level_id = bl.id')
|
|
94
|
-
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
95
|
-
.where('bl.id = :buildingLevelId', { buildingLevelId })
|
|
96
|
-
.orderBy('bi.updated_at', 'DESC')
|
|
97
|
-
|
|
98
|
-
if (limit) {
|
|
99
|
-
queryBuilder.limit(limit)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
103
|
-
|
|
104
|
-
return { items, total }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 층 별로 검수 개수 써머리
|
|
108
|
-
@Query(returns => BuildingInspectionSummary!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })
|
|
109
|
-
async buildingInspectionSummaryOfBuildingLevel(
|
|
110
|
-
@Arg('buildingLevelId') buildingLevelId: string,
|
|
111
|
-
@Ctx() context: ResolverContext
|
|
112
|
-
): Promise<BuildingInspectionSummary> {
|
|
113
|
-
const buildingInspectionSummary = await getRepository(BuildingInspection)
|
|
114
|
-
.createQueryBuilder('bi')
|
|
115
|
-
.select(
|
|
116
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
|
|
117
|
-
)
|
|
118
|
-
.addSelect(
|
|
119
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
|
|
120
|
-
)
|
|
121
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
122
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
123
|
-
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
|
|
124
|
-
.groupBy('bi.building_level_id')
|
|
125
|
-
.getRawOne()
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
wait: buildingInspectionSummary?.wait || 0,
|
|
129
|
-
request: buildingInspectionSummary?.request || 0,
|
|
130
|
-
pass: buildingInspectionSummary?.pass || 0,
|
|
131
|
-
fail: buildingInspectionSummary?.fail || 0
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// 층 별로 검수 개수 써머리
|
|
136
|
-
@Query(returns => [BuildingInspectionSummary]!, { nullable: true, description: 'To fetch a BuildingInspection Summary' })
|
|
137
|
-
async buildingInspectionDateSummaryOfLevelAndPeriod(
|
|
138
|
-
@Arg('buildingLevelId') buildingLevelId: string,
|
|
139
|
-
@Arg('startDate') startDate: string,
|
|
140
|
-
@Arg('endDate') endDate: string,
|
|
141
|
-
@Ctx() context: ResolverContext
|
|
142
|
-
): Promise<BuildingInspectionSummary[]> {
|
|
143
|
-
const buildingInspectionSummary = await getRepository(BuildingInspection)
|
|
144
|
-
.createQueryBuilder('bi')
|
|
145
|
-
.select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS "requestDate"`)
|
|
146
|
-
.addSelect(
|
|
147
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
|
|
148
|
-
)
|
|
149
|
-
.addSelect(
|
|
150
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
|
|
151
|
-
)
|
|
152
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
153
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
154
|
-
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
|
|
155
|
-
.andWhere('bi.request_date BETWEEN :startDate AND :endDate', { startDate, endDate })
|
|
156
|
-
.groupBy('bi.building_level_id')
|
|
157
|
-
.addGroupBy('bi.request_date')
|
|
158
|
-
.getRawMany()
|
|
159
|
-
|
|
160
|
-
return buildingInspectionSummary
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// 층 별로 검수 개수 써머리
|
|
164
|
-
@FieldResolver(type => BuildingInspectionSummary)
|
|
165
|
-
async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {
|
|
166
|
-
const buildingInspectionSummary = await getRepository(BuildingInspection)
|
|
167
|
-
.createQueryBuilder('bi')
|
|
168
|
-
.select(
|
|
169
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
|
|
170
|
-
)
|
|
171
|
-
.addSelect(
|
|
172
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
|
|
173
|
-
)
|
|
174
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
175
|
-
.addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
176
|
-
.where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })
|
|
177
|
-
.groupBy('bi.building_level_id')
|
|
178
|
-
.getRawOne()
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
wait: buildingInspectionSummary?.wait || 0,
|
|
182
|
-
request: buildingInspectionSummary?.request || 0,
|
|
183
|
-
pass: buildingInspectionSummary?.pass || 0,
|
|
184
|
-
fail: buildingInspectionSummary?.fail || 0
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
@Query(returns => BuildingInspectionSummary, { description: '프로젝트의 검측상태 별 카운트' })
|
|
189
|
-
async buildingInspectionSummaryOfProject(
|
|
190
|
-
@Arg('projectId') projectId: string,
|
|
191
|
-
@Ctx() context: ResolverContext
|
|
192
|
-
): Promise<BuildingInspectionSummary> {
|
|
193
|
-
const { domain } = context.state
|
|
194
|
-
|
|
195
|
-
const result = await getRepository(Project)
|
|
196
|
-
.createQueryBuilder('p')
|
|
197
|
-
.select(
|
|
198
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' OR bi.status='${BuildingInspectionStatus.OVERALL_WAIT}' THEN 1 ELSE NULL END) AS wait`
|
|
199
|
-
)
|
|
200
|
-
.addSelect(
|
|
201
|
-
`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' OR bi.status='${BuildingInspectionStatus.OVERALL_REQUEST}' THEN 1 ELSE NULL END) AS request`
|
|
202
|
-
)
|
|
203
|
-
.addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
|
|
204
|
-
.addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
|
|
205
|
-
.innerJoin('p.buildingComplex', 'bc')
|
|
206
|
-
.innerJoin('bc.buildings', 'b')
|
|
207
|
-
.innerJoin('b.buildingLevels', 'bl')
|
|
208
|
-
.leftJoin('building_inspections', 'bi', 'bi.building_level_id = bl.id AND bi.deleted_at IS NULL')
|
|
209
|
-
.where('p.domain = :domain', { domain: domain.id })
|
|
210
|
-
.andWhere('p.id = :projectId', { projectId })
|
|
211
|
-
.groupBy('p.id')
|
|
212
|
-
.getRawOne()
|
|
213
|
-
|
|
214
|
-
return {
|
|
215
|
-
wait: result?.wait || 0,
|
|
216
|
-
request: result?.request || 0,
|
|
217
|
-
pass: result?.pass || 0,
|
|
218
|
-
fail: result?.fail || 0
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
@FieldResolver(type => Checklist)
|
|
223
|
-
async checklist(@Root() buildingInspection: BuildingInspection): Promise<Checklist> {
|
|
224
|
-
return await getRepository(Checklist).findOneBy({ id: buildingInspection.checklistId })
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@FieldResolver(type => BuildingLevel)
|
|
228
|
-
async buildingLevel(@Root() buildingInspection: BuildingInspection): Promise<BuildingLevel> {
|
|
229
|
-
return await getRepository(BuildingLevel).findOneBy({ id: buildingInspection.buildingLevelId })
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
@FieldResolver(type => [Attachment])
|
|
233
|
-
async attatchments(@Root() buildingInspection: BuildingInspection): Promise<Attachment[] | undefined> {
|
|
234
|
-
const attachment: Attachment[] = await getRepository(Attachment).find({
|
|
235
|
-
where: {
|
|
236
|
-
refType: BuildingInspection.name,
|
|
237
|
-
refBy: buildingInspection.id
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
return attachment
|
|
241
|
-
}
|
|
242
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int } from 'type-graphql'
|
|
2
|
-
import { BuildingInspection } from './building-inspection'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
class ChecklistInputType {
|
|
6
|
-
@Field({ nullable: false })
|
|
7
|
-
name: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: false })
|
|
10
|
-
constructionType: string
|
|
11
|
-
|
|
12
|
-
@Field({ nullable: false })
|
|
13
|
-
constructionDetailType: string
|
|
14
|
-
|
|
15
|
-
@Field({ nullable: false })
|
|
16
|
-
location?: string
|
|
17
|
-
|
|
18
|
-
@Field({ nullable: false })
|
|
19
|
-
inspectionDrawingType?: string
|
|
20
|
-
|
|
21
|
-
@Field(type => [String], { nullable: false })
|
|
22
|
-
inspectionParts?: string[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@InputType()
|
|
26
|
-
class ChecklistItemInputType {
|
|
27
|
-
@Field({ nullable: false })
|
|
28
|
-
name: string
|
|
29
|
-
|
|
30
|
-
@Field({ nullable: false })
|
|
31
|
-
mainType: string
|
|
32
|
-
|
|
33
|
-
@Field({ nullable: false })
|
|
34
|
-
detailType: string
|
|
35
|
-
|
|
36
|
-
@Field({ nullable: true })
|
|
37
|
-
inspctionCriteria: string
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@InputType()
|
|
41
|
-
export class NewBuildingInspection {
|
|
42
|
-
@Field({ nullable: false })
|
|
43
|
-
buildingLevelId: string
|
|
44
|
-
|
|
45
|
-
@Field(type => ChecklistInputType, { nullable: false })
|
|
46
|
-
checklist: ChecklistInputType
|
|
47
|
-
|
|
48
|
-
@Field(type => [ChecklistItemInputType], { nullable: false })
|
|
49
|
-
checklistItem: ChecklistItemInputType[]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@InputType()
|
|
53
|
-
class ChecklistSubmitInputType {
|
|
54
|
-
@Field({ nullable: false })
|
|
55
|
-
id: string
|
|
56
|
-
|
|
57
|
-
@Field({ nullable: true })
|
|
58
|
-
overallConstructorSignature?: string
|
|
59
|
-
|
|
60
|
-
@Field({ nullable: true })
|
|
61
|
-
taskConstructorSignature?: string
|
|
62
|
-
|
|
63
|
-
@Field({ nullable: true })
|
|
64
|
-
overallSupervisorySignature?: string
|
|
65
|
-
|
|
66
|
-
@Field({ nullable: true })
|
|
67
|
-
taskSupervisorySignature?: string
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@InputType()
|
|
71
|
-
class ChecklistItemSubmitInputType {
|
|
72
|
-
@Field({ nullable: false })
|
|
73
|
-
id: string
|
|
74
|
-
|
|
75
|
-
@Field({ nullable: true })
|
|
76
|
-
constructionConfirmStatus?: string
|
|
77
|
-
|
|
78
|
-
@Field({ nullable: true })
|
|
79
|
-
supervisoryConfirmStatus?: string
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@InputType()
|
|
83
|
-
export class UpdateBuildingInspectionSubmitType {
|
|
84
|
-
@Field({ nullable: false })
|
|
85
|
-
id: string
|
|
86
|
-
|
|
87
|
-
@Field(type => ChecklistSubmitInputType, { nullable: false })
|
|
88
|
-
checklist: ChecklistSubmitInputType
|
|
89
|
-
|
|
90
|
-
@Field(type => [ChecklistItemSubmitInputType], { nullable: false })
|
|
91
|
-
checklistItem: ChecklistItemSubmitInputType[]
|
|
92
|
-
}
|
|
93
|
-
@InputType()
|
|
94
|
-
export class UpdateBuildingInspectionDrawingMarker {
|
|
95
|
-
@Field({ nullable: false })
|
|
96
|
-
id: string
|
|
97
|
-
|
|
98
|
-
@Field(type => String, { nullable: true })
|
|
99
|
-
drawingMarker?: string
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@InputType()
|
|
103
|
-
export class BuildingInspectionsOfProject {
|
|
104
|
-
@Field({ nullable: false })
|
|
105
|
-
projectId: string
|
|
106
|
-
|
|
107
|
-
@Field({ nullable: true })
|
|
108
|
-
limit: number
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
@InputType()
|
|
112
|
-
export class BuildingInspectionsOfBuildingLevel {
|
|
113
|
-
@Field({ nullable: false })
|
|
114
|
-
buildingLevelId: string
|
|
115
|
-
|
|
116
|
-
@Field({ nullable: true })
|
|
117
|
-
limit: number
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@ObjectType()
|
|
121
|
-
export class BuildingInspectionSummary {
|
|
122
|
-
@Field(type => String, { nullable: true, description: '요청일자' })
|
|
123
|
-
requestDate?: string
|
|
124
|
-
|
|
125
|
-
@Field(type => Int, { description: '검측 대기 수' })
|
|
126
|
-
wait: number
|
|
127
|
-
|
|
128
|
-
@Field(type => Int, { description: '검측 요청 수' })
|
|
129
|
-
request: number
|
|
130
|
-
|
|
131
|
-
@Field(type => Int, { description: '검측 통과 수' })
|
|
132
|
-
pass: number
|
|
133
|
-
|
|
134
|
-
@Field(type => Int, { description: '검측 실패 수' })
|
|
135
|
-
fail: number
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
@ObjectType()
|
|
139
|
-
export class BuildingInspectionList {
|
|
140
|
-
@Field(type => [BuildingInspection])
|
|
141
|
-
items: BuildingInspection[]
|
|
142
|
-
|
|
143
|
-
@Field(type => Int)
|
|
144
|
-
total: number
|
|
145
|
-
}
|