@dssp/supervision 0.0.10 → 0.0.11
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/client/pages/building-inspection/building-inspection-detail-checklist.ts +42 -1
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +2 -2
- package/client/pages/checklist/checklist-view.ts +32 -12
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +42 -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.js +2 -2
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -1
- package/dist-client/pages/checklist/checklist-view.js +40 -6
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.d.ts +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.js +6 -6
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +3 -2
- package/dist-server/service/building-inspection/building-inspection-mutation.js +81 -2
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +18 -1
- package/dist-server/service/building-inspection/building-inspection-type.js +67 -7
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -1
- package/dist-server/service/checklist/checklist-history.d.ts +2 -2
- package/dist-server/service/checklist/checklist-history.js +3 -3
- package/dist-server/service/checklist/checklist-history.js.map +1 -1
- package/dist-server/service/checklist/checklist.d.ts +2 -2
- package/dist-server/service/checklist/checklist.js +2 -2
- package/dist-server/service/checklist/checklist.js.map +1 -1
- package/dist-server/service/index.js +2 -1
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/server/service/building-inspection/building-inspection-history.ts +5 -5
- package/server/service/building-inspection/building-inspection-mutation.ts +95 -3
- package/server/service/building-inspection/building-inspection-type.ts +43 -2
- package/server/service/checklist/checklist-history.ts +3 -3
- package/server/service/checklist/checklist.ts +2 -2
- package/server/service/index.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dssp/supervision",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
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.
|
|
31
|
-
"@dssp/project": "^0.0.
|
|
30
|
+
"@dssp/building-complex": "^0.0.11",
|
|
31
|
+
"@dssp/project": "^0.0.11",
|
|
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": "
|
|
40
|
+
"gitHead": "a52f2688d11ebf3e7d727fbd8ff825920840be83"
|
|
41
41
|
}
|
|
@@ -21,6 +21,9 @@ export class BuildingInspectionHistory implements HistoryEntityInterface<Buildin
|
|
|
21
21
|
@Field(type => ID)
|
|
22
22
|
readonly id: string
|
|
23
23
|
|
|
24
|
+
@HistoryOriginalIdColumn()
|
|
25
|
+
public originalId!: string
|
|
26
|
+
|
|
24
27
|
@Column({ nullable: false, comment: '상태(REQUEST: 요청, PASS: 합격, FAIL: 불합격)' })
|
|
25
28
|
@Field({ nullable: true })
|
|
26
29
|
status?: BuildingInspectionStatus
|
|
@@ -30,7 +33,7 @@ export class BuildingInspectionHistory implements HistoryEntityInterface<Buildin
|
|
|
30
33
|
@Field({ nullable: true })
|
|
31
34
|
buildingLevel?: BuildingLevel
|
|
32
35
|
|
|
33
|
-
@RelationId((
|
|
36
|
+
@RelationId((buildingInspectionHistory: BuildingInspectionHistory) => buildingInspectionHistory.buildingLevel)
|
|
34
37
|
buildingLevelId?: string
|
|
35
38
|
|
|
36
39
|
@Column({ nullable: false, comment: '검측 요청일' })
|
|
@@ -50,12 +53,9 @@ export class BuildingInspectionHistory implements HistoryEntityInterface<Buildin
|
|
|
50
53
|
@Field(type => User, { nullable: true })
|
|
51
54
|
creator?: User
|
|
52
55
|
|
|
53
|
-
@RelationId((
|
|
56
|
+
@RelationId((buildingInspectionHistory: BuildingInspectionHistory) => buildingInspectionHistory.creator)
|
|
54
57
|
creatorId?: string
|
|
55
58
|
|
|
56
|
-
@HistoryOriginalIdColumn()
|
|
57
|
-
public originalId!: string
|
|
58
|
-
|
|
59
59
|
@HistoryActionColumn({
|
|
60
60
|
nullable: false,
|
|
61
61
|
type:
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
2
|
import { In } from 'typeorm'
|
|
3
3
|
import { BuildingInspection } from './building-inspection'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
NewBuildingInspection,
|
|
6
|
+
UpdateBuildingInspectionDrawingMarker,
|
|
7
|
+
UpdateBuildingInspectionSubmitType
|
|
8
|
+
} from './building-inspection-type'
|
|
5
9
|
import { BuildingInspectionStatus } from './building-inspection'
|
|
6
10
|
import { Checklist } from '../checklist/checklist'
|
|
7
11
|
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
@@ -67,10 +71,98 @@ export class BuildingInspectionMutation {
|
|
|
67
71
|
return result
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
// 검측 상태 변경 & 체크리스트 갱신
|
|
75
|
+
@Directive('@transaction')
|
|
76
|
+
@Mutation(returns => Boolean, { description: 'To create Building Inspection And Checklist information' })
|
|
77
|
+
async updateBuildingInspectionChecklist(
|
|
78
|
+
@Arg('buildingInspection') buildingInspection: UpdateBuildingInspectionSubmitType,
|
|
79
|
+
@Ctx() context: ResolverContext
|
|
80
|
+
): Promise<boolean> {
|
|
81
|
+
const { user, tx } = context.state
|
|
82
|
+
const { id: buildingInspectionId, checklist, checklistItem } = buildingInspection
|
|
83
|
+
const buildingInspectionRepo = tx.getRepository(BuildingInspection)
|
|
84
|
+
const checklistRepo = tx.getRepository(Checklist)
|
|
85
|
+
const checklistItemRepo = tx.getRepository(ChecklistItem)
|
|
86
|
+
const oldBuildingInspection = await buildingInspectionRepo.findOneBy({ id: buildingInspectionId })
|
|
87
|
+
const status = oldBuildingInspection.status
|
|
88
|
+
const isConstructor: boolean = status == BuildingInspectionStatus.WAIT || status == BuildingInspectionStatus.FAIL
|
|
89
|
+
let inspectionStatus = null
|
|
90
|
+
|
|
91
|
+
// 1. 벨리데이션
|
|
92
|
+
if (!buildingInspectionId) throw new Error('검측 아이디가 없습니다.')
|
|
93
|
+
if (!status) throw new Error('검측 상태가 없습니다.')
|
|
94
|
+
if (status == BuildingInspectionStatus.PASS) throw new Error('검측 상태가 수정할 수 있는 상태가 아닙니다.')
|
|
95
|
+
|
|
96
|
+
if (isConstructor) {
|
|
97
|
+
// 시공자 타입별 밸리데이션
|
|
98
|
+
if (checklistItem.length !== checklistItem.filter(v => v.constructionConfirmStatus).length) {
|
|
99
|
+
throw new Error('아이템을 모두 체크해야 합니다.')
|
|
100
|
+
}
|
|
101
|
+
if (!checklist.overallConstructorSignature) throw new Error('총괄 시공책임자 사인이 없습니다.')
|
|
102
|
+
if (!checklist.taskConstructorSignature) throw new Error('공종별 시공관리자 사인이 없습니다.')
|
|
103
|
+
|
|
104
|
+
// 시공자 상태 데이터
|
|
105
|
+
const isPassed = checklistItem.length === checklistItem.filter(v => v.constructionConfirmStatus === 'T').length
|
|
106
|
+
inspectionStatus = isPassed ? BuildingInspectionStatus.REQUEST : BuildingInspectionStatus.FAIL
|
|
107
|
+
// 시공자가 검측 요청시 검측자 사인은 초기화
|
|
108
|
+
if (inspectionStatus === BuildingInspectionStatus.REQUEST) {
|
|
109
|
+
checklist.overallSupervisorySignature = null
|
|
110
|
+
checklist.taskSupervisorySignature = null
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
// 감리자 타입별 밸리데이션
|
|
114
|
+
if (checklistItem.length !== checklistItem.filter(v => v.supervisoryConfirmStatus).length) {
|
|
115
|
+
throw new Error('아이템을 모두 체크해야 합니다.')
|
|
116
|
+
}
|
|
117
|
+
if (!checklist.overallSupervisorySignature) throw new Error('총괄 감리책임자 사인이 없습니다.')
|
|
118
|
+
if (!checklist.taskSupervisorySignature) throw new Error('공종별 감리 책임자 사인이 없습니다.')
|
|
119
|
+
|
|
120
|
+
// 감리자 상태 데이터
|
|
121
|
+
const isPassed = checklistItem.length === checklistItem.filter(v => v.supervisoryConfirmStatus === 'T').length
|
|
122
|
+
inspectionStatus = isPassed ? BuildingInspectionStatus.PASS : BuildingInspectionStatus.FAIL
|
|
123
|
+
// 감리사가 검측 불합격으로 재검측 요청시 시공자 사인은 초기화
|
|
124
|
+
if (inspectionStatus === BuildingInspectionStatus.FAIL) {
|
|
125
|
+
checklist.overallConstructorSignature = null
|
|
126
|
+
checklist.taskConstructorSignature = null
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 2. buildingInspection 저장
|
|
131
|
+
await buildingInspectionRepo.save({
|
|
132
|
+
...oldBuildingInspection,
|
|
133
|
+
status: inspectionStatus,
|
|
134
|
+
updater: user
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
// 3. checklist 저장
|
|
138
|
+
const oldChecklist = await checklistRepo.findOneBy({ id: checklist.id })
|
|
139
|
+
const inspectionDateField = isConstructor ? 'constructionInspectionDate' : 'supervisorInspectionDate'
|
|
140
|
+
await checklistRepo.save({
|
|
141
|
+
...oldChecklist,
|
|
142
|
+
[inspectionDateField]: new Date(),
|
|
143
|
+
overallConstructorSignature: checklist.overallConstructorSignature,
|
|
144
|
+
taskConstructorSignature: checklist.taskConstructorSignature,
|
|
145
|
+
overallSupervisorySignature: checklist.overallSupervisorySignature,
|
|
146
|
+
taskSupervisorySignature: checklist.taskSupervisorySignature,
|
|
147
|
+
updater: user
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// 4. checklistItem 저장
|
|
151
|
+
for (let item of checklistItem) {
|
|
152
|
+
const confirmStatusField = isConstructor ? 'constructionConfirmStatus' : 'supervisoryConfirmStatus'
|
|
153
|
+
await checklistItemRepo.update(item.id, {
|
|
154
|
+
[confirmStatusField]: item[confirmStatusField],
|
|
155
|
+
updater: user
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return true
|
|
160
|
+
}
|
|
161
|
+
|
|
70
162
|
@Directive('@transaction')
|
|
71
163
|
@Mutation(returns => BuildingInspection, { description: 'To update Building Inspection information' })
|
|
72
164
|
async updateBuildingInspection(
|
|
73
|
-
@Arg('patch') patch:
|
|
165
|
+
@Arg('patch') patch: UpdateBuildingInspectionDrawingMarker,
|
|
74
166
|
@Ctx() context: ResolverContext
|
|
75
167
|
): Promise<BuildingInspection> {
|
|
76
168
|
const { user, tx } = context.state
|
|
@@ -95,7 +187,7 @@ export class BuildingInspectionMutation {
|
|
|
95
187
|
@Arg('ids', type => [String]) ids: string[],
|
|
96
188
|
@Ctx() context: ResolverContext
|
|
97
189
|
): Promise<boolean> {
|
|
98
|
-
const {
|
|
190
|
+
const { tx } = context.state
|
|
99
191
|
const buildingInspectionRepository = tx.getRepository(BuildingInspection)
|
|
100
192
|
const checklistRepository = tx.getRepository(Checklist)
|
|
101
193
|
const checklistItemRepository = tx.getRepository(ChecklistItem)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { BuildingInspection } from './building-inspection'
|
|
2
|
+
import { BuildingInspection, BuildingInspectionStatus } from './building-inspection'
|
|
3
3
|
|
|
4
4
|
@InputType()
|
|
5
5
|
class ChecklistInputType {
|
|
@@ -50,7 +50,48 @@ export class NewBuildingInspection {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@InputType()
|
|
53
|
-
|
|
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 {
|
|
54
95
|
@Field({ nullable: false })
|
|
55
96
|
id: string
|
|
56
97
|
|
|
@@ -46,11 +46,11 @@ export class ChecklistHistory implements HistoryEntityInterface<Checklist> {
|
|
|
46
46
|
|
|
47
47
|
@Column({ nullable: true, comment: '시공자 점검일' })
|
|
48
48
|
@Field({ nullable: true })
|
|
49
|
-
|
|
49
|
+
constructionInspectionDate?: Date
|
|
50
50
|
|
|
51
51
|
@Column({ nullable: true, comment: '감리자 점검일' })
|
|
52
52
|
@Field({ nullable: true })
|
|
53
|
-
|
|
53
|
+
supervisorInspectionDate?: Date
|
|
54
54
|
|
|
55
55
|
@Column({ nullable: true, comment: '총괄 시공 책임자 사인' })
|
|
56
56
|
@Field({ nullable: true })
|
|
@@ -76,7 +76,7 @@ export class ChecklistHistory implements HistoryEntityInterface<Checklist> {
|
|
|
76
76
|
@Field(type => User, { nullable: true })
|
|
77
77
|
creator?: User
|
|
78
78
|
|
|
79
|
-
@RelationId((
|
|
79
|
+
@RelationId((checklistHistory: ChecklistHistory) => checklistHistory.creator)
|
|
80
80
|
creatorId?: string
|
|
81
81
|
|
|
82
82
|
@HistoryOriginalIdColumn()
|
|
@@ -58,11 +58,11 @@ export class Checklist {
|
|
|
58
58
|
|
|
59
59
|
@Column({ nullable: true, comment: '시공자 점검일' })
|
|
60
60
|
@Field({ nullable: true })
|
|
61
|
-
|
|
61
|
+
constructionInspectionDate?: Date
|
|
62
62
|
|
|
63
63
|
@Column({ nullable: true, comment: '감리자 점검일' })
|
|
64
64
|
@Field({ nullable: true })
|
|
65
|
-
|
|
65
|
+
supervisorInspectionDate?: Date
|
|
66
66
|
|
|
67
67
|
@Column({ nullable: true, comment: '총괄 시공 책임자 사인' })
|
|
68
68
|
@Field({ nullable: true })
|
package/server/service/index.ts
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
resolvers as SupervisorResolvers,
|
|
28
28
|
subscribers as SupervisorSubscribers
|
|
29
29
|
} from './supervisor'
|
|
30
|
-
import { entities as ChecklistEntities, resolvers as ChecklistResolvers } from './checklist'
|
|
30
|
+
import { entities as ChecklistEntities, resolvers as ChecklistResolvers, subscribers as ChecklistSubscribers } from './checklist'
|
|
31
31
|
import { entities as ChecklistItemEntities, resolvers as ChecklistItemResolvers } from './checklist-item'
|
|
32
32
|
import { entities as ChecklistTypeEntities, resolvers as ChecklistTypeResolvers } from './checklist-type'
|
|
33
33
|
import { entities as ChecklistTemplateEntities, resolvers as ChecklistTemplateResolvers } from './checklist-template'
|
|
@@ -58,7 +58,8 @@ export const subscribers = [
|
|
|
58
58
|
...IssueSubscribers,
|
|
59
59
|
...ProjectReportSubscribers,
|
|
60
60
|
...SupervisorSubscribers,
|
|
61
|
-
...BuildingInspectionSubscribers
|
|
61
|
+
...BuildingInspectionSubscribers,
|
|
62
|
+
...ChecklistSubscribers
|
|
62
63
|
]
|
|
63
64
|
|
|
64
65
|
export const schema = {
|