@dssp/supervision 0.0.24 → 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.
Files changed (33) hide show
  1. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +5 -0
  2. package/client/pages/building-inspection/building-inspection-list.ts +31 -13
  3. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +24 -5
  4. package/client/pages/checklist/checklist-view.ts +69 -27
  5. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +6 -1
  6. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
  7. package/dist-client/pages/building-inspection/building-inspection-list.d.ts +5 -1
  8. package/dist-client/pages/building-inspection/building-inspection-list.js +31 -12
  9. package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -1
  10. package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js +23 -5
  11. package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -1
  12. package/dist-client/pages/checklist/checklist-view.js +73 -31
  13. package/dist-client/pages/checklist/checklist-view.js.map +1 -1
  14. package/dist-client/route.d.ts +1 -1
  15. package/dist-client/tsconfig.tsbuildinfo +1 -1
  16. package/dist-server/service/building-inspection/building-inspection-history.js +4 -1
  17. package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
  18. package/dist-server/service/building-inspection/building-inspection-mutation.js +36 -12
  19. package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
  20. package/dist-server/service/building-inspection/building-inspection-query.js +8 -8
  21. package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -1
  22. package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
  23. package/dist-server/service/building-inspection/building-inspection.d.ts +2 -0
  24. package/dist-server/service/building-inspection/building-inspection.js +4 -2
  25. package/dist-server/service/building-inspection/building-inspection.js.map +1 -1
  26. package/dist-server/service/index.d.ts +1 -1
  27. package/dist-server/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +4 -4
  29. package/server/service/building-inspection/building-inspection-history.ts +5 -1
  30. package/server/service/building-inspection/building-inspection-mutation.ts +37 -11
  31. package/server/service/building-inspection/building-inspection-query.ts +24 -8
  32. package/server/service/building-inspection/building-inspection-type.ts +2 -2
  33. package/server/service/building-inspection/building-inspection.ts +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dssp/supervision",
3
- "version": "0.0.24",
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.24",
31
- "@dssp/project": "^0.0.24",
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": "534da1901bb069b633bb2aa390817724cc542a6f"
40
+ "gitHead": "240bdb67cf79bb5d922fc082db3d84f6e3cc488c"
41
41
  }
@@ -22,7 +22,11 @@ export class BuildingInspectionHistory implements HistoryEntityInterface<Buildin
22
22
  @HistoryOriginalIdColumn()
23
23
  public originalId!: string
24
24
 
25
- @Column({ nullable: false, comment: '상태(REQUEST: 요청, PASS: 합격, FAIL: 불합격)' })
25
+ @Column({
26
+ nullable: false,
27
+ comment:
28
+ '상태(WAIT: 검측 대기, OVERALL_WAIT: 총괄자 검측 대기, REQUEST: 검측 요청, OVERALL_REQUEST: 총괄자 검측 요청, PASS: 합격, FAIL: 불합격)'
29
+ })
26
30
  @Field({ nullable: true })
27
31
  status?: BuildingInspectionStatus
28
32
 
@@ -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
 
@@ -112,8 +112,12 @@ export class BuildingInspectionQuery {
112
112
  ): Promise<BuildingInspectionSummary> {
113
113
  const buildingInspectionSummary = await getRepository(BuildingInspection)
114
114
  .createQueryBuilder('bi')
115
- .select(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' THEN 1 ELSE NULL END) AS wait`)
116
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
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
+ )
117
121
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
118
122
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
119
123
  .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
@@ -139,8 +143,12 @@ export class BuildingInspectionQuery {
139
143
  const buildingInspectionSummary = await getRepository(BuildingInspection)
140
144
  .createQueryBuilder('bi')
141
145
  .select(`TO_CHAR(bi.request_date, 'YYYY-MM-DD') AS "requestDate"`)
142
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' THEN 1 ELSE NULL END) AS wait`)
143
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
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
+ )
144
152
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
145
153
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
146
154
  .where('bi.building_level_id = :buildingLevelId', { buildingLevelId })
@@ -157,8 +165,12 @@ export class BuildingInspectionQuery {
157
165
  async buildingInspectionSummary(@Root() buildingLevel: BuildingLevel): Promise<BuildingInspectionSummary> {
158
166
  const buildingInspectionSummary = await getRepository(BuildingInspection)
159
167
  .createQueryBuilder('bi')
160
- .select(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.WAIT}' THEN 1 ELSE NULL END) AS wait`)
161
- .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
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
+ )
162
174
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
163
175
  .addSelect(`COUNT(CASE WHEN bi.status='${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
164
176
  .where('bi.building_level_id = :buildingLevelId', { buildingLevelId: buildingLevel.id })
@@ -182,8 +194,12 @@ export class BuildingInspectionQuery {
182
194
 
183
195
  const result = await getRepository(Project)
184
196
  .createQueryBuilder('p')
185
- .select(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.WAIT}' THEN 1 ELSE NULL END) AS wait`)
186
- .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.REQUEST}' THEN 1 ELSE NULL END) AS request`)
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
+ )
187
203
  .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.PASS}' THEN 1 ELSE NULL END) AS pass`)
188
204
  .addSelect(`COUNT(CASE WHEN bi.status = '${BuildingInspectionStatus.FAIL}' THEN 1 ELSE NULL END) AS fail`)
189
205
  .innerJoin('p.buildingComplex', 'bc')
@@ -1,5 +1,5 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
- import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
1
+ import { ObjectType, Field, InputType, Int } from 'type-graphql'
2
+ import { BuildingInspection } from './building-inspection'
3
3
 
4
4
  @InputType()
5
5
  class ChecklistInputType {
@@ -18,7 +18,9 @@ import { Checklist } from '../checklist/checklist'
18
18
 
19
19
  export enum BuildingInspectionStatus {
20
20
  WAIT = 'WAIT',
21
+ OVERALL_WAIT = 'OVERALL_WAIT',
21
22
  REQUEST = 'REQUEST',
23
+ OVERALL_REQUEST = 'OVERALL_REQUEST',
22
24
  PASS = 'PASS',
23
25
  FAIL = 'FAIL'
24
26
  }
@@ -46,8 +48,9 @@ export class BuildingInspection {
46
48
 
47
49
  @Column({
48
50
  nullable: false,
49
- comment: '상태(WAIT: 검측 대기, REQUEST: 검측 요청, PASS: 합격, FAIL: 불합격)',
50
- default: 'WAIT'
51
+ comment:
52
+ '상태(WAIT: 검측 대기, OVERALL_WAIT: 총괄자 검측 대기, REQUEST: 검측 요청, OVERALL_REQUEST: 총괄자 검측 요청, PASS: 합격, FAIL: 불합격)',
53
+ default: BuildingInspectionStatus.WAIT
51
54
  })
52
55
  @Field({ nullable: true })
53
56
  status?: BuildingInspectionStatus