@dssp/supervision 0.0.8 → 0.0.10
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 +186 -0
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +160 -0
- package/client/pages/building-inspection/building-inspection-list.ts +430 -0
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +94 -0
- package/client/pages/building-inspection/inspection-create-popup.ts +696 -0
- package/client/pages/checklist/checklist-view.ts +443 -0
- package/client/pages/checklist-template/checklist-template-item.ts +240 -0
- package/client/pages/checklist-template/checklist-template-list.ts +271 -0
- package/client/pages/checklist-template/checklist-type-management.ts +242 -0
- package/client/route.ts +14 -18
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.d.ts +21 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +187 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.d.ts +21 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js +169 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-drawing.js.map +1 -0
- package/dist-client/pages/building-inspection/building-inspection-list.d.ts +67 -0
- package/dist-client/pages/building-inspection/building-inspection-list.js +434 -0
- package/dist-client/pages/building-inspection/building-inspection-list.js.map +1 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.d.ts +1 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js +118 -0
- package/dist-client/pages/building-inspection/component/building-inspection-detail-header.js.map +1 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.d.ts +3 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.js +735 -0
- package/dist-client/pages/building-inspection/inspection-create-popup.js.map +1 -0
- package/dist-client/pages/checklist/checklist-view.d.ts +6 -0
- package/dist-client/pages/checklist/checklist-view.js +434 -0
- package/dist-client/pages/checklist/checklist-view.js.map +1 -0
- package/dist-client/pages/checklist-template/checklist-template-item.d.ts +2 -0
- package/dist-client/pages/checklist-template/checklist-template-item.js +237 -0
- package/dist-client/pages/checklist-template/checklist-template-item.js.map +1 -0
- package/dist-client/pages/{check-item/check-item-list-page.d.ts → checklist-template/checklist-template-list.d.ts} +8 -27
- package/dist-client/pages/checklist-template/checklist-template-list.js +259 -0
- package/dist-client/pages/checklist-template/checklist-template-list.js.map +1 -0
- package/dist-client/pages/checklist-template/checklist-type-management.d.ts +48 -0
- package/dist-client/pages/checklist-template/checklist-type-management.js +229 -0
- package/dist-client/pages/checklist-template/checklist-type-management.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +10 -13
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +1 -1
- package/dist-server/index.js +1 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/service/building-inspection/building-inspection-history.d.ts +17 -0
- package/dist-server/service/building-inspection/building-inspection-history.js +85 -0
- package/dist-server/service/building-inspection/building-inspection-history.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.d.ts +8 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js +148 -0
- package/dist-server/service/building-inspection/building-inspection-mutation.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-query.d.ts +20 -0
- package/dist-server/service/building-inspection/building-inspection-query.js +235 -0
- package/dist-server/service/building-inspection/building-inspection-query.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection-type.d.ts +43 -0
- package/dist-server/service/building-inspection/building-inspection-type.js +153 -0
- package/dist-server/service/building-inspection/building-inspection-type.js.map +1 -0
- package/dist-server/service/building-inspection/building-inspection.d.ts +26 -0
- package/dist-server/service/building-inspection/building-inspection.js +113 -0
- package/dist-server/service/building-inspection/building-inspection.js.map +1 -0
- package/dist-server/service/building-inspection/event-subscriber.d.ts +7 -0
- package/dist-server/service/building-inspection/event-subscriber.js +21 -0
- package/dist-server/service/building-inspection/event-subscriber.js.map +1 -0
- package/dist-server/service/building-inspection/index.d.ts +10 -0
- package/dist-server/service/building-inspection/index.js +14 -0
- package/dist-server/service/building-inspection/index.js.map +1 -0
- package/dist-server/service/checklist/checklist-history.d.ts +24 -0
- package/dist-server/service/checklist/checklist-history.js +120 -0
- package/dist-server/service/checklist/checklist-history.js.map +1 -0
- package/dist-server/service/checklist/checklist-mutation.d.ts +8 -0
- package/dist-server/service/checklist/checklist-mutation.js +96 -0
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -0
- package/dist-server/service/checklist/checklist-query.d.ts +12 -0
- package/dist-server/service/checklist/checklist-query.js +83 -0
- package/dist-server/service/checklist/checklist-query.js.map +1 -0
- package/dist-server/service/checklist/checklist-type.d.ts +18 -0
- package/dist-server/service/checklist/checklist-type.js +69 -0
- package/dist-server/service/checklist/checklist-type.js.map +1 -0
- package/dist-server/service/checklist/checklist.d.ts +31 -0
- package/dist-server/service/checklist/checklist.js +143 -0
- package/dist-server/service/checklist/checklist.js.map +1 -0
- package/dist-server/service/checklist/event-subscriber.d.ts +7 -0
- package/dist-server/service/checklist/event-subscriber.js +21 -0
- package/dist-server/service/checklist/event-subscriber.js.map +1 -0
- package/dist-server/service/checklist/index.d.ts +8 -0
- package/dist-server/service/checklist/index.js +12 -0
- package/dist-server/service/checklist/index.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.d.ts +2 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.js +13 -0
- package/dist-server/service/checklist-item/checklist-item-mutation.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-query.d.ts +10 -0
- package/dist-server/service/checklist-item/checklist-item-query.js +68 -0
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item-type.d.ts +5 -0
- package/dist-server/service/checklist-item/checklist-item-type.js +21 -0
- package/dist-server/service/checklist-item/checklist-item-type.js.map +1 -0
- package/dist-server/service/checklist-item/checklist-item.d.ts +26 -0
- package/dist-server/service/checklist-item/checklist-item.js +113 -0
- package/dist-server/service/checklist-item/checklist-item.js.map +1 -0
- package/dist-server/service/checklist-item/index.d.ts +5 -0
- package/dist-server/service/checklist-item/index.js +10 -0
- package/dist-server/service/checklist-item/index.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.d.ts +6 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.js +64 -0
- package/dist-server/service/checklist-template/checklist-template-mutation.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-query.d.ts +10 -0
- package/dist-server/service/checklist-template/checklist-template-query.js +65 -0
- package/dist-server/service/checklist-template/checklist-template-query.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template-type.d.ts +10 -0
- package/dist-server/service/checklist-template/checklist-template-type.js +39 -0
- package/dist-server/service/checklist-template/checklist-template-type.js.map +1 -0
- package/dist-server/service/checklist-template/checklist-template.d.ts +17 -0
- package/dist-server/service/checklist-template/checklist-template.js +78 -0
- package/dist-server/service/checklist-template/checklist-template.js.map +1 -0
- package/dist-server/service/checklist-template/index.d.ts +5 -0
- package/dist-server/service/checklist-template/index.js +9 -0
- package/dist-server/service/checklist-template/index.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.d.ts +7 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js +68 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-mutation.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.d.ts +10 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js +66 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-query.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.d.ts +16 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js +60 -0
- package/dist-server/service/checklist-template-item/checklist-template-item-type.js.map +1 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.d.ts +19 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js +87 -0
- package/dist-server/service/checklist-template-item/checklist-template-item.js.map +1 -0
- package/dist-server/service/checklist-template-item/index.d.ts +5 -0
- package/dist-server/service/checklist-template-item/index.js +9 -0
- package/dist-server/service/checklist-template-item/index.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.d.ts +6 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.js +64 -0
- package/dist-server/service/checklist-type/checklist-type-mutation.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-query.d.ts +10 -0
- package/dist-server/service/checklist-type/checklist-type-query.js +65 -0
- package/dist-server/service/checklist-type/checklist-type-query.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type-type.d.ts +11 -0
- package/dist-server/service/checklist-type/checklist-type-type.js +43 -0
- package/dist-server/service/checklist-type/checklist-type-type.js.map +1 -0
- package/dist-server/service/checklist-type/checklist-type.d.ts +19 -0
- package/dist-server/service/checklist-type/checklist-type.js +78 -0
- package/dist-server/service/checklist-type/checklist-type.js.map +1 -0
- package/dist-server/service/checklist-type/index.d.ts +5 -0
- package/dist-server/service/checklist-type/index.js +9 -0
- package/dist-server/service/checklist-type/index.js.map +1 -0
- package/dist-server/service/index.d.ts +8 -3
- package/dist-server/service/index.js +25 -5
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/issue/issue.d.ts +1 -3
- package/dist-server/service/issue/issue.js +1 -7
- package/dist-server/service/issue/issue.js.map +1 -1
- package/dist-server/service/supervisor/supervisor.d.ts +1 -3
- package/dist-server/service/supervisor/supervisor.js +1 -7
- package/dist-server/service/supervisor/supervisor.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/supervision/checklist-item.md +160 -0
- package/helps/supervision/checklist.md +160 -0
- package/package.json +11 -7
- package/server/index.ts +1 -1
- package/server/service/building-inspection/building-inspection-history.ts +70 -0
- package/server/service/building-inspection/building-inspection-mutation.ts +147 -0
- package/server/service/building-inspection/building-inspection-query.ts +202 -0
- package/server/service/building-inspection/building-inspection-type.ts +101 -0
- package/server/service/building-inspection/building-inspection.ts +106 -0
- package/server/service/building-inspection/event-subscriber.ts +20 -0
- package/server/service/building-inspection/index.ts +11 -0
- package/server/service/checklist/checklist-history.ts +96 -0
- package/server/service/checklist/checklist-mutation.ts +103 -0
- package/server/service/checklist/checklist-query.ts +52 -0
- package/server/service/{check-item/check-item-type.ts → checklist/checklist-type.ts} +6 -18
- package/server/service/checklist/checklist.ts +127 -0
- package/server/service/checklist/event-subscriber.ts +17 -0
- package/server/service/checklist/index.ts +9 -0
- package/server/service/checklist-item/checklist-item-mutation.ts +5 -0
- package/server/service/checklist-item/checklist-item-query.ts +43 -0
- package/server/service/checklist-item/checklist-item-type.ts +12 -0
- package/server/service/checklist-item/checklist-item.ts +100 -0
- package/server/service/checklist-item/index.ts +7 -0
- package/server/service/checklist-template/checklist-template-mutation.ts +66 -0
- package/server/service/checklist-template/checklist-template-query.ts +39 -0
- package/server/service/checklist-template/checklist-template-type.ts +23 -0
- package/server/service/checklist-template/checklist-template.ts +71 -0
- package/server/service/checklist-template/index.ts +6 -0
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +64 -0
- package/server/service/checklist-template-item/checklist-template-item-query.ts +39 -0
- package/server/service/checklist-template-item/checklist-template-item-type.ts +39 -0
- package/server/service/checklist-template-item/checklist-template-item.ts +67 -0
- package/server/service/checklist-template-item/index.ts +6 -0
- package/server/service/checklist-type/checklist-type-mutation.ts +66 -0
- package/server/service/checklist-type/checklist-type-query.ts +39 -0
- package/server/service/checklist-type/checklist-type-type.ts +26 -0
- package/server/service/checklist-type/checklist-type.ts +64 -0
- package/server/service/checklist-type/index.ts +6 -0
- package/server/service/index.ts +59 -23
- package/server/service/issue/issue.ts +1 -6
- package/server/service/supervisor/supervisor.ts +1 -6
- package/things-factory.config.js +11 -7
- package/client/pages/check-item/check-item-importer.ts +0 -94
- package/client/pages/check-item/check-item-list-page.ts +0 -340
- package/dist-client/pages/check-item/check-item-importer.d.ts +0 -10
- package/dist-client/pages/check-item/check-item-importer.js +0 -101
- package/dist-client/pages/check-item/check-item-importer.js.map +0 -1
- package/dist-client/pages/check-item/check-item-list-page.js +0 -323
- package/dist-client/pages/check-item/check-item-list-page.js.map +0 -1
- package/dist-server/service/check-item/check-item-mutation.d.ts +0 -10
- package/dist-server/service/check-item/check-item-mutation.js +0 -168
- package/dist-server/service/check-item/check-item-mutation.js.map +0 -1
- package/dist-server/service/check-item/check-item-query.d.ts +0 -12
- package/dist-server/service/check-item/check-item-query.js +0 -97
- package/dist-server/service/check-item/check-item-query.js.map +0 -1
- package/dist-server/service/check-item/check-item-type.d.ts +0 -23
- package/dist-server/service/check-item/check-item-type.js +0 -86
- package/dist-server/service/check-item/check-item-type.js.map +0 -1
- package/dist-server/service/check-item/check-item.d.ts +0 -28
- package/dist-server/service/check-item/check-item.js +0 -117
- package/dist-server/service/check-item/check-item.js.map +0 -1
- package/dist-server/service/check-item/index.d.ts +0 -6
- package/dist-server/service/check-item/index.js +0 -10
- package/dist-server/service/check-item/index.js.map +0 -1
- package/server/service/check-item/check-item-mutation.ts +0 -198
- package/server/service/check-item/check-item-query.ts +0 -62
- package/server/service/check-item/check-item.ts +0 -111
- package/server/service/check-item/index.ts +0 -7
|
@@ -4,31 +4,25 @@ import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-gr
|
|
|
4
4
|
|
|
5
5
|
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Checklist } from './checklist'
|
|
8
8
|
|
|
9
9
|
@InputType()
|
|
10
|
-
export class
|
|
10
|
+
export class NewChecklist {
|
|
11
11
|
@Field()
|
|
12
12
|
name: string
|
|
13
13
|
|
|
14
14
|
@Field({ nullable: true })
|
|
15
15
|
description?: string
|
|
16
16
|
|
|
17
|
-
@Field(type => CheckItemStatus, { nullable: true })
|
|
18
|
-
state?: CheckItemStatus
|
|
19
|
-
|
|
20
17
|
@Field({ nullable: true })
|
|
21
18
|
active?: boolean
|
|
22
19
|
|
|
23
20
|
@Field({ nullable: true })
|
|
24
21
|
params?: string
|
|
25
|
-
|
|
26
|
-
@Field(type => GraphQLUpload, { nullable: true })
|
|
27
|
-
thumbnail?: FileUpload
|
|
28
22
|
}
|
|
29
23
|
|
|
30
24
|
@InputType()
|
|
31
|
-
export class
|
|
25
|
+
export class ChecklistPatch {
|
|
32
26
|
@Field(type => ID, { nullable: true })
|
|
33
27
|
id?: string
|
|
34
28
|
|
|
@@ -38,23 +32,17 @@ export class CheckItemPatch {
|
|
|
38
32
|
@Field({ nullable: true })
|
|
39
33
|
description?: string
|
|
40
34
|
|
|
41
|
-
@Field(type => CheckItemStatus, { nullable: true })
|
|
42
|
-
state?: CheckItemStatus
|
|
43
|
-
|
|
44
35
|
@Field({ nullable: true })
|
|
45
36
|
active?: boolean
|
|
46
37
|
|
|
47
|
-
@Field(type => GraphQLUpload, { nullable: true })
|
|
48
|
-
thumbnail?: FileUpload
|
|
49
|
-
|
|
50
38
|
@Field({ nullable: true })
|
|
51
39
|
cuFlag?: string
|
|
52
40
|
}
|
|
53
41
|
|
|
54
42
|
@ObjectType()
|
|
55
|
-
export class
|
|
56
|
-
@Field(type => [
|
|
57
|
-
items:
|
|
43
|
+
export class ChecklistList {
|
|
44
|
+
@Field(type => [Checklist])
|
|
45
|
+
items: Checklist[]
|
|
58
46
|
|
|
59
47
|
@Field(type => Int)
|
|
60
48
|
total: number
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
Column,
|
|
8
|
+
RelationId,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
OneToMany,
|
|
11
|
+
OneToOne,
|
|
12
|
+
JoinColumn,
|
|
13
|
+
PrimaryGeneratedColumn
|
|
14
|
+
} from 'typeorm'
|
|
15
|
+
import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
|
|
16
|
+
|
|
17
|
+
import { User } from '@things-factory/auth-base'
|
|
18
|
+
import { Task } from '@dssp/project'
|
|
19
|
+
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
20
|
+
import { BuildingInspection } from '../building-inspection/building-inspection'
|
|
21
|
+
|
|
22
|
+
@Entity({ comment: '체크리스트' })
|
|
23
|
+
@Index('ix_checklist_0', (checklist: Checklist) => [checklist.task], { where: '"deleted_at" IS NULL' })
|
|
24
|
+
@Index('ix_checklist_1', (checklist: Checklist) => [checklist.documentNo, checklist.createdAt], { where: '"deleted_at" IS NULL' })
|
|
25
|
+
@ObjectType()
|
|
26
|
+
export class Checklist {
|
|
27
|
+
@PrimaryGeneratedColumn('uuid')
|
|
28
|
+
@Field(type => ID)
|
|
29
|
+
readonly id: string
|
|
30
|
+
|
|
31
|
+
@Column({ nullable: true, comment: '이름' })
|
|
32
|
+
@Field({ nullable: true })
|
|
33
|
+
name?: string
|
|
34
|
+
|
|
35
|
+
@Column({ nullable: true, comment: '문서 번호 동(4자리)-층(3자리)-시퀀스(6자리)' })
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
documentNo?: string
|
|
38
|
+
|
|
39
|
+
@Column({ nullable: false, comment: '공종' })
|
|
40
|
+
@Field({ nullable: true })
|
|
41
|
+
constructionType?: string
|
|
42
|
+
|
|
43
|
+
@Column({ nullable: false, comment: '세부 공종' })
|
|
44
|
+
@Field({ nullable: true })
|
|
45
|
+
constructionDetailType?: string
|
|
46
|
+
|
|
47
|
+
@Column({ nullable: false, comment: '위치 (x동 x층)' })
|
|
48
|
+
@Field({ nullable: true })
|
|
49
|
+
location?: string
|
|
50
|
+
|
|
51
|
+
@Column({ nullable: false, comment: '검측 도면 타입', default: '' })
|
|
52
|
+
@Field({ nullable: true })
|
|
53
|
+
inspectionDrawingType?: string
|
|
54
|
+
|
|
55
|
+
@Column('simple-array', { nullable: true, comment: '검측 부위' })
|
|
56
|
+
@Field(() => [String], { nullable: true })
|
|
57
|
+
inspectionParts?: string[]
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true, comment: '시공자 점검일' })
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
constructionInsprctionDate?: Date
|
|
62
|
+
|
|
63
|
+
@Column({ nullable: true, comment: '감리자 점검일' })
|
|
64
|
+
@Field({ nullable: true })
|
|
65
|
+
supervisorInsprctionDate?: Date
|
|
66
|
+
|
|
67
|
+
@Column({ nullable: true, comment: '총괄 시공 책임자 사인' })
|
|
68
|
+
@Field({ nullable: true })
|
|
69
|
+
overallConstructorSignature?: string
|
|
70
|
+
|
|
71
|
+
@Column({ nullable: true, comment: '공종별 시공 관리자 사인' })
|
|
72
|
+
@Field({ nullable: true })
|
|
73
|
+
taskConstructorSignature?: string
|
|
74
|
+
|
|
75
|
+
@Column({ nullable: true, comment: '총괄 감리 책임자 사인' })
|
|
76
|
+
@Field({ nullable: true })
|
|
77
|
+
overallSupervisorySignature?: string
|
|
78
|
+
|
|
79
|
+
@Column({ nullable: true, comment: '건축사보 (공종별 감리 관리자) 사인' })
|
|
80
|
+
@Field({ nullable: true })
|
|
81
|
+
taskSupervisorySignature?: string
|
|
82
|
+
|
|
83
|
+
// 공정표 작업 정보 (상위 테이블 참조)
|
|
84
|
+
@ManyToOne(() => Task)
|
|
85
|
+
@JoinColumn()
|
|
86
|
+
@Field(() => Task)
|
|
87
|
+
task?: Task
|
|
88
|
+
|
|
89
|
+
@RelationId((checklist: Checklist) => checklist.task)
|
|
90
|
+
taskId?: string
|
|
91
|
+
|
|
92
|
+
// 체크리스트 아이템 정보 (하위 테이블 참조)
|
|
93
|
+
@OneToMany(() => ChecklistItem, checklistItem => checklistItem.checklist)
|
|
94
|
+
@Field(() => [ChecklistItem])
|
|
95
|
+
checklistItems?: ChecklistItem[]
|
|
96
|
+
|
|
97
|
+
// 검측 정보 (1:1 하위 테이블 참조)
|
|
98
|
+
@OneToOne(() => BuildingInspection, buildingInspection => buildingInspection.checklist)
|
|
99
|
+
@Field(() => BuildingInspection)
|
|
100
|
+
buildingInspection?: BuildingInspection
|
|
101
|
+
|
|
102
|
+
@CreateDateColumn()
|
|
103
|
+
@Field({ nullable: true })
|
|
104
|
+
createdAt?: Date
|
|
105
|
+
|
|
106
|
+
@UpdateDateColumn()
|
|
107
|
+
@Field({ nullable: true })
|
|
108
|
+
updatedAt?: Date
|
|
109
|
+
|
|
110
|
+
@DeleteDateColumn()
|
|
111
|
+
@Field({ nullable: true })
|
|
112
|
+
deletedAt?: Date
|
|
113
|
+
|
|
114
|
+
@ManyToOne(type => User, { nullable: true })
|
|
115
|
+
@Field(type => User, { nullable: true })
|
|
116
|
+
creator?: User
|
|
117
|
+
|
|
118
|
+
@RelationId((checklist: Checklist) => checklist.creator)
|
|
119
|
+
creatorId?: string
|
|
120
|
+
|
|
121
|
+
@ManyToOne(type => User, { nullable: true })
|
|
122
|
+
@Field(type => User, { nullable: true })
|
|
123
|
+
updater?: User
|
|
124
|
+
|
|
125
|
+
@RelationId((checklist: Checklist) => checklist.updater)
|
|
126
|
+
updaterId?: string
|
|
127
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventSubscriber } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
+
|
|
5
|
+
import { Checklist } from './checklist'
|
|
6
|
+
import { ChecklistHistory } from './checklist-history'
|
|
7
|
+
|
|
8
|
+
@EventSubscriber()
|
|
9
|
+
export class ChecklistHistoryEntitySubscriber extends HistoryEntitySubscriber<Checklist, ChecklistHistory> {
|
|
10
|
+
public get entity() {
|
|
11
|
+
return Checklist
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public get historyEntity() {
|
|
15
|
+
return ChecklistHistory
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Checklist } from './checklist'
|
|
2
|
+
import { ChecklistQuery } from './checklist-query'
|
|
3
|
+
import { ChecklistHistory } from './checklist-history'
|
|
4
|
+
import { ChecklistMutation } from './checklist-mutation'
|
|
5
|
+
import { ChecklistHistoryEntitySubscriber } from './event-subscriber'
|
|
6
|
+
|
|
7
|
+
export const entities = [Checklist, ChecklistHistory]
|
|
8
|
+
export const resolvers = [ChecklistQuery, ChecklistMutation]
|
|
9
|
+
export const subscribers = [ChecklistHistoryEntitySubscriber]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
+
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
4
|
+
import { User } from '@things-factory/auth-base'
|
|
5
|
+
import { ChecklistItem } from './checklist-item'
|
|
6
|
+
import { ChecklistItemList } from './checklist-item-type'
|
|
7
|
+
|
|
8
|
+
@Resolver(ChecklistItem)
|
|
9
|
+
export class ChecklistItemQuery {
|
|
10
|
+
@Query(returns => ChecklistItem!, { nullable: true, description: 'To fetch a ChecklistItem' })
|
|
11
|
+
async checklistItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ChecklistItem> {
|
|
12
|
+
const { domain } = context.state
|
|
13
|
+
|
|
14
|
+
return await getRepository(ChecklistItem).findOne({
|
|
15
|
+
where: { id }
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Query(returns => ChecklistItemList, { description: 'To fetch multiple ChecklistItems' })
|
|
20
|
+
async checklistItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistItemList> {
|
|
21
|
+
const { domain } = context.state
|
|
22
|
+
|
|
23
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
24
|
+
params,
|
|
25
|
+
repository: await getRepository(ChecklistItem),
|
|
26
|
+
searchables: ['name', 'description']
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
30
|
+
|
|
31
|
+
return { items, total }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@FieldResolver(type => User)
|
|
35
|
+
async updater(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
36
|
+
return await getRepository(User).findOneBy({ id: checklistItem.updaterId })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@FieldResolver(type => User)
|
|
40
|
+
async creator(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
41
|
+
return await getRepository(User).findOneBy({ id: checklistItem.creatorId })
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
|
2
|
+
|
|
3
|
+
import { ChecklistItem } from './checklist-item'
|
|
4
|
+
|
|
5
|
+
@ObjectType()
|
|
6
|
+
export class ChecklistItemList {
|
|
7
|
+
@Field(type => [ChecklistItem])
|
|
8
|
+
items: ChecklistItem[]
|
|
9
|
+
|
|
10
|
+
@Field(type => Int)
|
|
11
|
+
total: number
|
|
12
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
Column,
|
|
8
|
+
RelationId,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
PrimaryGeneratedColumn
|
|
11
|
+
} from 'typeorm'
|
|
12
|
+
import { ObjectType, Field, ID, Int, registerEnumType } from 'type-graphql'
|
|
13
|
+
|
|
14
|
+
import { User } from '@things-factory/auth-base'
|
|
15
|
+
import { Checklist } from '../checklist/checklist'
|
|
16
|
+
|
|
17
|
+
export enum ChecklistItemConfirmStatus {
|
|
18
|
+
T = '적합',
|
|
19
|
+
F = '부적합'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
registerEnumType(ChecklistItemConfirmStatus, {
|
|
23
|
+
name: 'ChecklistItemConfirmStatus',
|
|
24
|
+
description: '적합 상태'
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
@Entity({ comment: '체크 리스트 항목' })
|
|
28
|
+
@Index('ix_checklist_item_0', (checklistItem: ChecklistItem) => [checklistItem.checklist], { where: '"deleted_at" IS NULL' })
|
|
29
|
+
@ObjectType()
|
|
30
|
+
export class ChecklistItem {
|
|
31
|
+
@PrimaryGeneratedColumn('uuid')
|
|
32
|
+
@Field(type => ID)
|
|
33
|
+
readonly id: string
|
|
34
|
+
|
|
35
|
+
@Column({ nullable: true, comment: '시퀀스' })
|
|
36
|
+
@Field(type => Int, { nullable: true })
|
|
37
|
+
sequence?: number
|
|
38
|
+
|
|
39
|
+
@Column({ nullable: false, comment: '구분 (텍스트)' })
|
|
40
|
+
@Field({ nullable: false })
|
|
41
|
+
mainType?: string
|
|
42
|
+
|
|
43
|
+
@Column({ nullable: false, comment: '상세 구분 (텍스트)' })
|
|
44
|
+
@Field({ nullable: false })
|
|
45
|
+
detailType?: string
|
|
46
|
+
|
|
47
|
+
@Column({ nullable: true, comment: '검사 항목' })
|
|
48
|
+
@Field({ nullable: true })
|
|
49
|
+
name?: string
|
|
50
|
+
|
|
51
|
+
@Column({ nullable: true, comment: '검사 기준' })
|
|
52
|
+
@Field({ nullable: true })
|
|
53
|
+
inspctionCriteria?: string
|
|
54
|
+
|
|
55
|
+
@Column({ nullable: true, comment: '시공 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
56
|
+
@Field({ nullable: true })
|
|
57
|
+
constructionConfirmStatus?: ChecklistItemConfirmStatus
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true, comment: '감리 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
supervisoryConfirmStatus?: ChecklistItemConfirmStatus
|
|
62
|
+
|
|
63
|
+
@Column({ nullable: true, comment: '참고 사항' })
|
|
64
|
+
@Field({ nullable: true })
|
|
65
|
+
comment?: string
|
|
66
|
+
|
|
67
|
+
// 체크리스트 정보 (상위 테이블 참조)
|
|
68
|
+
@ManyToOne(type => Checklist)
|
|
69
|
+
@Field(type => Checklist, { nullable: true })
|
|
70
|
+
checklist?: Checklist
|
|
71
|
+
|
|
72
|
+
@RelationId((checklistItem: ChecklistItem) => checklistItem.checklist)
|
|
73
|
+
checklistId?: string
|
|
74
|
+
|
|
75
|
+
@CreateDateColumn()
|
|
76
|
+
@Field({ nullable: true })
|
|
77
|
+
createdAt?: Date
|
|
78
|
+
|
|
79
|
+
@UpdateDateColumn()
|
|
80
|
+
@Field({ nullable: true })
|
|
81
|
+
updatedAt?: Date
|
|
82
|
+
|
|
83
|
+
@DeleteDateColumn()
|
|
84
|
+
@Field({ nullable: true })
|
|
85
|
+
deletedAt?: Date
|
|
86
|
+
|
|
87
|
+
@ManyToOne(type => User, { nullable: true })
|
|
88
|
+
@Field(type => User, { nullable: true })
|
|
89
|
+
creator?: User
|
|
90
|
+
|
|
91
|
+
@RelationId((checklistItem: ChecklistItem) => checklistItem.creator)
|
|
92
|
+
creatorId?: string
|
|
93
|
+
|
|
94
|
+
@ManyToOne(type => User, { nullable: true })
|
|
95
|
+
@Field(type => User, { nullable: true })
|
|
96
|
+
updater?: User
|
|
97
|
+
|
|
98
|
+
@RelationId((checklistItem: ChecklistItem) => checklistItem.updater)
|
|
99
|
+
updaterId?: string
|
|
100
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChecklistItem } from './checklist-item'
|
|
2
|
+
import { ChecklistItemQuery } from './checklist-item-query'
|
|
3
|
+
import { ChecklistItemMutation } from './checklist-item-mutation'
|
|
4
|
+
|
|
5
|
+
export const entities = [ChecklistItem]
|
|
6
|
+
export const resolvers = [ChecklistItemQuery, ChecklistItemMutation]
|
|
7
|
+
export const subscribers = []
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
import { ChecklistTemplate } from './checklist-template'
|
|
4
|
+
import { ChecklistTemplatePatch } from './checklist-template-type'
|
|
5
|
+
|
|
6
|
+
@Resolver(ChecklistTemplate)
|
|
7
|
+
export class ChecklistTemplateMutation {
|
|
8
|
+
@Directive('@transaction')
|
|
9
|
+
@Mutation(returns => [ChecklistTemplate], { description: "To modify multiple ChecklistTemplates' information" })
|
|
10
|
+
async updateMultipleChecklistTemplate(
|
|
11
|
+
@Arg('patches', type => [ChecklistTemplatePatch]) patches: ChecklistTemplatePatch[],
|
|
12
|
+
@Ctx() context: ResolverContext
|
|
13
|
+
): Promise<ChecklistTemplate[]> {
|
|
14
|
+
const { domain, user, tx } = context.state
|
|
15
|
+
|
|
16
|
+
let results = []
|
|
17
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
18
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
19
|
+
const checklistTemplateRepo = tx.getRepository(ChecklistTemplate)
|
|
20
|
+
|
|
21
|
+
if (_createRecords.length > 0) {
|
|
22
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
23
|
+
const newRecord = _createRecords[i]
|
|
24
|
+
|
|
25
|
+
const result = await checklistTemplateRepo.save({
|
|
26
|
+
...newRecord,
|
|
27
|
+
domain,
|
|
28
|
+
creator: user,
|
|
29
|
+
updater: user
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
results.push({ ...result, cuFlag: '+' })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (_updateRecords.length > 0) {
|
|
37
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
38
|
+
const updateRecord = _updateRecords[i]
|
|
39
|
+
const checklistTemplate = await checklistTemplateRepo.findOneBy({ id: updateRecord.id })
|
|
40
|
+
|
|
41
|
+
const result = await checklistTemplateRepo.save({
|
|
42
|
+
...checklistTemplate,
|
|
43
|
+
...updateRecord,
|
|
44
|
+
updater: user
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return results
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Directive('@transaction')
|
|
55
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple ChecklistTemplates' })
|
|
56
|
+
async deleteChecklistTemplates(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
57
|
+
const { domain, tx } = context.state
|
|
58
|
+
|
|
59
|
+
await tx.getRepository(ChecklistTemplate).delete({
|
|
60
|
+
domain: { id: domain.id },
|
|
61
|
+
id: In(ids)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Ctx } from 'type-graphql'
|
|
2
|
+
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { ChecklistTemplate } from './checklist-template'
|
|
5
|
+
import { ChecklistTemplateList } from './checklist-template-type'
|
|
6
|
+
|
|
7
|
+
@Resolver(ChecklistTemplate)
|
|
8
|
+
export class ChecklistTemplateQuery {
|
|
9
|
+
@Query(returns => ChecklistTemplateList, { description: 'To fetch multiple ChecklistTemplates' })
|
|
10
|
+
async checklistTemplates(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistTemplateList> {
|
|
11
|
+
const { domain } = context.state
|
|
12
|
+
|
|
13
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
14
|
+
domain,
|
|
15
|
+
params,
|
|
16
|
+
repository: await getRepository(ChecklistTemplate),
|
|
17
|
+
searchables: ['name']
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
21
|
+
|
|
22
|
+
return { items, total }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@FieldResolver(type => Domain)
|
|
26
|
+
async domain(@Root() checklistTemplate: ChecklistTemplate): Promise<Domain> {
|
|
27
|
+
return await getRepository(Domain).findOneBy({ id: checklistTemplate.domainId })
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@FieldResolver(type => User)
|
|
31
|
+
async updater(@Root() checklistTemplate: ChecklistTemplate): Promise<User> {
|
|
32
|
+
return await getRepository(User).findOneBy({ id: checklistTemplate.updaterId })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@FieldResolver(type => User)
|
|
36
|
+
async creator(@Root() checklistTemplate: ChecklistTemplate): Promise<User> {
|
|
37
|
+
return await getRepository(User).findOneBy({ id: checklistTemplate.creatorId })
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
+
import { ChecklistTemplate } from './checklist-template'
|
|
3
|
+
|
|
4
|
+
@InputType()
|
|
5
|
+
export class ChecklistTemplatePatch {
|
|
6
|
+
@Field(type => ID, { nullable: true })
|
|
7
|
+
id?: string
|
|
8
|
+
|
|
9
|
+
@Field({ nullable: true })
|
|
10
|
+
name?: string
|
|
11
|
+
|
|
12
|
+
@Field({ nullable: true })
|
|
13
|
+
cuFlag?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@ObjectType()
|
|
17
|
+
export class ChecklistTemplateList {
|
|
18
|
+
@Field(type => [ChecklistTemplate])
|
|
19
|
+
items: ChecklistTemplate[]
|
|
20
|
+
|
|
21
|
+
@Field(type => Int)
|
|
22
|
+
total: number
|
|
23
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
Column,
|
|
8
|
+
RelationId,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
OneToMany,
|
|
11
|
+
PrimaryGeneratedColumn
|
|
12
|
+
} from 'typeorm'
|
|
13
|
+
import { ObjectType, Field, ID } from 'type-graphql'
|
|
14
|
+
|
|
15
|
+
import { Domain } from '@things-factory/shell'
|
|
16
|
+
import { User } from '@things-factory/auth-base'
|
|
17
|
+
import { ChecklistTemplateItem } from '../checklist-template-item/checklist-template-item'
|
|
18
|
+
|
|
19
|
+
@Entity({ comment: '체크리스트 템플릿' })
|
|
20
|
+
@Index('ix_checklist_template_0', (checklistTemplate: ChecklistTemplate) => [checklistTemplate.domain, checklistTemplate.name], {
|
|
21
|
+
unique: true,
|
|
22
|
+
where: '"deleted_at" IS NULL'
|
|
23
|
+
})
|
|
24
|
+
@ObjectType()
|
|
25
|
+
export class ChecklistTemplate {
|
|
26
|
+
@PrimaryGeneratedColumn('uuid')
|
|
27
|
+
@Field(type => ID)
|
|
28
|
+
readonly id: string
|
|
29
|
+
|
|
30
|
+
@ManyToOne(type => Domain)
|
|
31
|
+
@Field({ nullable: true })
|
|
32
|
+
domain?: Domain
|
|
33
|
+
|
|
34
|
+
@RelationId((checklistTemplate: ChecklistTemplate) => checklistTemplate.domain)
|
|
35
|
+
domainId?: string
|
|
36
|
+
|
|
37
|
+
@Column({ nullable: true, comment: '이름' })
|
|
38
|
+
@Field({ nullable: true })
|
|
39
|
+
name?: string
|
|
40
|
+
|
|
41
|
+
// 체크리스트 템플릿 아이템 정보 (하위 테이블 참조)
|
|
42
|
+
@Field(() => [ChecklistTemplateItem])
|
|
43
|
+
@OneToMany(() => ChecklistTemplateItem, checklistTemplateItem => checklistTemplateItem.checklistTemplate)
|
|
44
|
+
checklistTemplateItems?: ChecklistTemplateItem[]
|
|
45
|
+
|
|
46
|
+
@CreateDateColumn()
|
|
47
|
+
@Field({ nullable: true })
|
|
48
|
+
createdAt?: Date
|
|
49
|
+
|
|
50
|
+
@UpdateDateColumn()
|
|
51
|
+
@Field({ nullable: true })
|
|
52
|
+
updatedAt?: Date
|
|
53
|
+
|
|
54
|
+
@DeleteDateColumn()
|
|
55
|
+
@Field({ nullable: true })
|
|
56
|
+
deletedAt?: Date
|
|
57
|
+
|
|
58
|
+
@ManyToOne(type => User, { nullable: true })
|
|
59
|
+
@Field(type => User, { nullable: true })
|
|
60
|
+
creator?: User
|
|
61
|
+
|
|
62
|
+
@RelationId((checklistTemplate: ChecklistTemplate) => checklistTemplate.creator)
|
|
63
|
+
creatorId?: string
|
|
64
|
+
|
|
65
|
+
@ManyToOne(type => User, { nullable: true })
|
|
66
|
+
@Field(type => User, { nullable: true })
|
|
67
|
+
updater?: User
|
|
68
|
+
|
|
69
|
+
@RelationId((checklistTemplate: ChecklistTemplate) => checklistTemplate.updater)
|
|
70
|
+
updaterId?: string
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChecklistTemplate } from './checklist-template'
|
|
2
|
+
import { ChecklistTemplateQuery } from './checklist-template-query'
|
|
3
|
+
import { ChecklistTemplateMutation } from './checklist-template-mutation'
|
|
4
|
+
|
|
5
|
+
export const entities = [ChecklistTemplate]
|
|
6
|
+
export const resolvers = [ChecklistTemplateQuery, ChecklistTemplateMutation]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
import { ChecklistTemplateItem } from './checklist-template-item'
|
|
4
|
+
import { ChecklistTemplateItemPatch } from './checklist-template-item-type'
|
|
5
|
+
import { ChecklistTemplate } from '../checklist-template/checklist-template'
|
|
6
|
+
|
|
7
|
+
@Resolver(ChecklistTemplateItem)
|
|
8
|
+
export class ChecklistTemplateItemMutation {
|
|
9
|
+
@Directive('@transaction')
|
|
10
|
+
@Mutation(returns => [ChecklistTemplateItem], { description: "To modify multiple ChecklistTemplateItems' information" })
|
|
11
|
+
async updateMultipleChecklistTemplateItems(
|
|
12
|
+
@Arg('patches', type => [ChecklistTemplateItemPatch]) patches: ChecklistTemplateItemPatch[],
|
|
13
|
+
@Arg('checklistTemplateId') checklistTemplateId: string,
|
|
14
|
+
@Ctx() context: ResolverContext
|
|
15
|
+
): Promise<ChecklistTemplateItem[]> {
|
|
16
|
+
const { domain, user, tx } = context.state
|
|
17
|
+
|
|
18
|
+
let results = []
|
|
19
|
+
|
|
20
|
+
const checklistTemplateItemRepo = tx.getRepository(ChecklistTemplateItem)
|
|
21
|
+
const checklistTemplate = await tx.getRepository(ChecklistTemplate).findOneBy({ id: checklistTemplateId })
|
|
22
|
+
|
|
23
|
+
await checklistTemplateItemRepo.delete({ checklistTemplate: { id: checklistTemplateId } })
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < patches.length; i++) {
|
|
26
|
+
const result = await checklistTemplateItemRepo.save({
|
|
27
|
+
...patches[i],
|
|
28
|
+
sequence: i,
|
|
29
|
+
checklistTemplate,
|
|
30
|
+
creator: user,
|
|
31
|
+
updater: user
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
results.push({ ...result, cuFlag: '+' })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return results
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Directive('@transaction')
|
|
41
|
+
@Mutation(returns => Boolean, { description: 'To delete ChecklistTemplateItem' })
|
|
42
|
+
async deleteChecklistTemplateItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
43
|
+
const { domain, tx } = context.state
|
|
44
|
+
|
|
45
|
+
await tx.getRepository(ChecklistTemplateItem).delete({ id })
|
|
46
|
+
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Directive('@transaction')
|
|
51
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple ChecklistTemplateItems' })
|
|
52
|
+
async deleteChecklistTemplateItems(
|
|
53
|
+
@Arg('ids', type => [String]) ids: string[],
|
|
54
|
+
@Ctx() context: ResolverContext
|
|
55
|
+
): Promise<boolean> {
|
|
56
|
+
const { domain, tx } = context.state
|
|
57
|
+
|
|
58
|
+
await tx.getRepository(ChecklistTemplateItem).delete({
|
|
59
|
+
id: In(ids)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return true
|
|
63
|
+
}
|
|
64
|
+
}
|