@dssp/supervision 0.0.34 → 0.0.36
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 +9 -5
- package/client/pages/building-inspection/building-inspection-list.ts +10 -9
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +11 -5
- package/client/pages/checklist/attachment-list-popup.ts +22 -4
- package/client/pages/checklist/checklist-view.ts +34 -23
- package/client/pages/checklist/comment-list-popup.ts +12 -3
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +9 -5
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/pages/building-inspection/building-inspection-list.js +10 -9
- 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 +11 -5
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -1
- package/dist-client/pages/checklist/attachment-list-popup.js +24 -4
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/checklist-view.js +32 -18
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- package/dist-client/pages/checklist/comment-list-popup copy.d.ts +2 -0
- package/dist-client/pages/checklist/comment-list-popup copy.js +344 -0
- package/dist-client/pages/checklist/comment-list-popup copy.js.map +1 -0
- package/dist-client/pages/checklist/comment-list-popup.js +16 -3
- package/dist-client/pages/checklist/comment-list-popup.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.js +9 -1
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -1
- package/dist-server/service/checklist-item/checklist-item-query.d.ts +2 -0
- package/dist-server/service/checklist-item/checklist-item-query.js +15 -2
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js +19 -1
- package/dist-server/service/checklist-item-comment/checklist-item-comment-mutation.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/building-inspection/building-inspection-mutation.ts +13 -1
- package/server/service/checklist-item/checklist-item-query.ts +13 -6
- package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dssp/supervision",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,9 +27,9 @@
|
|
|
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/drawing": "^0.0.
|
|
32
|
-
"@dssp/project": "^0.0.
|
|
30
|
+
"@dssp/building-complex": "^0.0.36",
|
|
31
|
+
"@dssp/drawing": "^0.0.36",
|
|
32
|
+
"@dssp/project": "^0.0.36",
|
|
33
33
|
"@operato/event-view": "^8.0.0-alpha",
|
|
34
34
|
"@operato/graphql": "^8.0.0-alpha",
|
|
35
35
|
"@operato/image-marker": "^8.0.0-alpha",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@things-factory/auth-base": "^8.0.0-alpha",
|
|
40
40
|
"@things-factory/shell": "^8.0.0-alpha"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "07e0389d1068f9bd054d1e054d0ee2e5e88a65f2"
|
|
43
43
|
}
|
|
@@ -197,6 +197,12 @@ export class BuildingInspectionMutation {
|
|
|
197
197
|
if (!patch.id) throw new Error('검측 아이디가 없습니다.')
|
|
198
198
|
|
|
199
199
|
const buildingInspection = await buildingInspectionRepo.findOneBy({ id: patch.id })
|
|
200
|
+
|
|
201
|
+
// 완료 상태인 검측데이터면 삭제 못함
|
|
202
|
+
if (buildingInspection.status === BuildingInspectionStatus.PASS) {
|
|
203
|
+
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
204
|
+
}
|
|
205
|
+
|
|
200
206
|
const result = await buildingInspectionRepo.save({
|
|
201
207
|
...buildingInspection,
|
|
202
208
|
...patch,
|
|
@@ -217,8 +223,14 @@ export class BuildingInspectionMutation {
|
|
|
217
223
|
const checklistRepository = tx.getRepository(Checklist)
|
|
218
224
|
const checklistItemRepository = tx.getRepository(ChecklistItem)
|
|
219
225
|
|
|
220
|
-
// 검측 데이터 제거
|
|
221
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
|
+
// 검측 데이터 제거
|
|
222
234
|
await buildingInspectionRepository.softDelete({
|
|
223
235
|
id: In(ids)
|
|
224
236
|
})
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
2
|
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
-
import {
|
|
3
|
+
import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
4
4
|
import { User } from '@things-factory/auth-base'
|
|
5
5
|
import { ChecklistItem } from './checklist-item'
|
|
6
6
|
import { ChecklistItemList } from './checklist-item-type'
|
|
7
7
|
import { ChecklistItemComment } from '../checklist-item-comment/checklist-item-comment'
|
|
8
|
+
import { BuildingInspection } from '../building-inspection/building-inspection'
|
|
8
9
|
|
|
9
10
|
@Resolver(ChecklistItem)
|
|
10
11
|
export class ChecklistItemQuery {
|
|
11
12
|
@Query(returns => ChecklistItem!, { nullable: true, description: 'To fetch a ChecklistItem' })
|
|
12
13
|
async checklistItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ChecklistItem> {
|
|
13
|
-
const { domain } = context.state
|
|
14
|
-
|
|
15
14
|
return await getRepository(ChecklistItem).findOne({
|
|
16
15
|
where: { id }
|
|
17
16
|
})
|
|
@@ -19,8 +18,6 @@ export class ChecklistItemQuery {
|
|
|
19
18
|
|
|
20
19
|
@Query(returns => ChecklistItemList, { description: 'To fetch multiple ChecklistItems' })
|
|
21
20
|
async checklistItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistItemList> {
|
|
22
|
-
const { domain } = context.state
|
|
23
|
-
|
|
24
21
|
const queryBuilder = getQueryBuilderFromListParams({
|
|
25
22
|
params,
|
|
26
23
|
repository: await getRepository(ChecklistItem),
|
|
@@ -32,6 +29,16 @@ export class ChecklistItemQuery {
|
|
|
32
29
|
return { items, total }
|
|
33
30
|
}
|
|
34
31
|
|
|
32
|
+
@Query(returns => BuildingInspection, { description: 'BuildingInspection By ChecklistItemId' })
|
|
33
|
+
async inspectionByChecklistItemId(checklistItemId: string): Promise<BuildingInspection> {
|
|
34
|
+
return getRepository(BuildingInspection)
|
|
35
|
+
.createQueryBuilder('bi')
|
|
36
|
+
.innerJoin('checklists', 'c', 'bi.checklist_id = c.id')
|
|
37
|
+
.innerJoin('checklist_items', 'ci', 'c.id = ci.checklist_id')
|
|
38
|
+
.where('ci.id = :checklistItemId', { checklistItemId })
|
|
39
|
+
.getOne()
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
@FieldResolver(type => [ChecklistItemComment])
|
|
36
43
|
async checklistItemComments(@Root() checklistItem: ChecklistItem): Promise<ChecklistItemComment[]> {
|
|
37
44
|
return await getRepository(ChecklistItemComment).findBy({ checklistItem: { id: checklistItem.id } })
|
|
@@ -2,6 +2,8 @@ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
|
2
2
|
import { getRepository } from '@things-factory/shell'
|
|
3
3
|
import { ChecklistItemComment } from './checklist-item-comment'
|
|
4
4
|
import { NewChecklistItemComment, ChecklistItemCommentPatch } from './checklist-item-comment-type'
|
|
5
|
+
import { BuildingInspectionStatus } from '../building-inspection/building-inspection'
|
|
6
|
+
import { ChecklistItemQuery } from '../checklist-item/checklist-item-query'
|
|
5
7
|
|
|
6
8
|
@Resolver(ChecklistItemComment)
|
|
7
9
|
export class ChecklistItemCommentMutation {
|
|
@@ -14,6 +16,13 @@ export class ChecklistItemCommentMutation {
|
|
|
14
16
|
const { user, tx } = context.state
|
|
15
17
|
const { comment, checklistItemId } = checklistItemComment
|
|
16
18
|
|
|
19
|
+
// 합격 상태인지 체크
|
|
20
|
+
const checklistItemQuery = new ChecklistItemQuery()
|
|
21
|
+
const inspection = await checklistItemQuery.inspectionByChecklistItemId(checklistItemId)
|
|
22
|
+
if (inspection.status === BuildingInspectionStatus.PASS) {
|
|
23
|
+
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
const result = await getRepository(ChecklistItemComment, tx).save({
|
|
18
27
|
comment,
|
|
19
28
|
checklistItem: { id: checklistItemId },
|
|
@@ -52,8 +61,19 @@ export class ChecklistItemCommentMutation {
|
|
|
52
61
|
@Mutation(returns => Boolean, { description: 'To delete ChecklistItemComment' })
|
|
53
62
|
async deleteChecklistItemComment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
54
63
|
const { tx } = context.state
|
|
64
|
+
const repository = getRepository(ChecklistItemComment, tx)
|
|
65
|
+
const checklistItemComment = await repository.findOne({
|
|
66
|
+
where: { id }
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// 합격 상태인지 체크
|
|
70
|
+
const checklistItemQuery = new ChecklistItemQuery()
|
|
71
|
+
const inspection = await checklistItemQuery.inspectionByChecklistItemId(checklistItemComment.checklistItemId)
|
|
72
|
+
if (inspection.status === BuildingInspectionStatus.PASS) {
|
|
73
|
+
throw new Error('완료 상태인 검측정보를 변경할 수 없습니다.')
|
|
74
|
+
}
|
|
55
75
|
|
|
56
|
-
await
|
|
76
|
+
await repository.softDelete({ id })
|
|
57
77
|
|
|
58
78
|
return true
|
|
59
79
|
}
|