@dssp/supervision 0.0.25 → 0.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dssp/supervision",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,8 +27,8 @@
27
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
28
28
  },
29
29
  "dependencies": {
30
- "@dssp/building-complex": "^0.0.25",
31
- "@dssp/project": "^0.0.25",
30
+ "@dssp/building-complex": "^0.0.26",
31
+ "@dssp/project": "^0.0.26",
32
32
  "@operato/event-view": "^8.0.0-alpha",
33
33
  "@operato/graphql": "^8.0.0-alpha",
34
34
  "@operato/image-marker": "^8.0.0-alpha",
@@ -37,5 +37,5 @@
37
37
  "@things-factory/auth-base": "^8.0.0-alpha",
38
38
  "@things-factory/shell": "^8.0.0-alpha"
39
39
  },
40
- "gitHead": "428e139a9391cfc5b3b376cf247d58c9fc02351a"
40
+ "gitHead": "240bdb67cf79bb5d922fc082db3d84f6e3cc488c"
41
41
  }
@@ -84,7 +84,10 @@ export class BuildingInspectionMutation {
84
84
  const checklistItemRepo = tx.getRepository(ChecklistItem)
85
85
  const oldBuildingInspection = await buildingInspectionRepo.findOneBy({ id: buildingInspectionId })
86
86
  const status = oldBuildingInspection.status
87
- const isConstructor: boolean = status == BuildingInspectionStatus.WAIT || status == BuildingInspectionStatus.FAIL
87
+ const isConstructor: boolean =
88
+ status == BuildingInspectionStatus.WAIT ||
89
+ status == BuildingInspectionStatus.OVERALL_WAIT ||
90
+ status == BuildingInspectionStatus.FAIL
88
91
  let inspectionStatus = null
89
92
 
90
93
  // 1. 벨리데이션
@@ -97,14 +100,27 @@ export class BuildingInspectionMutation {
97
100
  if (checklistItem.length !== checklistItem.filter(v => v.constructionConfirmStatus).length) {
98
101
  throw new Error('아이템을 모두 체크해야 합니다.')
99
102
  }
100
- if (!checklist.overallConstructorSignature) throw new Error('총괄 시공책임자 사인이 없습니다.')
101
- if (!checklist.taskConstructorSignature) throw new Error('공종별 시공관리자 사인이 없습니다.')
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
+ }
102
109
 
103
110
  // 시공자 상태 데이터
104
111
  const isPassed = checklistItem.length === checklistItem.filter(v => v.constructionConfirmStatus === 'T').length
105
- inspectionStatus = isPassed ? BuildingInspectionStatus.REQUEST : BuildingInspectionStatus.FAIL
106
- // 시공자가 검측 요청시 검측자 사인은 초기화
107
- if (inspectionStatus === BuildingInspectionStatus.REQUEST) {
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
108
124
  checklist.overallSupervisorySignature = null
109
125
  checklist.taskSupervisorySignature = null
110
126
  }
@@ -113,16 +129,26 @@ export class BuildingInspectionMutation {
113
129
  if (checklistItem.length !== checklistItem.filter(v => v.supervisoryConfirmStatus).length) {
114
130
  throw new Error('아이템을 모두 체크해야 합니다.')
115
131
  }
116
- if (!checklist.overallSupervisorySignature) throw new Error('총괄 감리책임자 사인이 없습니다.')
117
- if (!checklist.taskSupervisorySignature) throw new Error('공종별 감리 책임자 사인이 없습니다.')
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
+ }
118
138
 
119
139
  // 감리자 상태 데이터
120
140
  const isPassed = checklistItem.length === checklistItem.filter(v => v.supervisoryConfirmStatus === 'T').length
121
- inspectionStatus = isPassed ? BuildingInspectionStatus.PASS : BuildingInspectionStatus.FAIL
122
- // 감리사가 검측 불합격으로 재검측 요청시 시공자 사인은 초기화
123
- if (inspectionStatus === BuildingInspectionStatus.FAIL) {
141
+ if (!isPassed) {
142
+ // 1. 검측이 불햡격 = 상태는 불합격으로, 시공자 싸인은 모두 초기화
143
+ inspectionStatus = BuildingInspectionStatus.FAIL
124
144
  checklist.overallConstructorSignature = null
125
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
126
152
  }
127
153
  }
128
154