@dssp/supervision 1.0.0-alpha.0 → 1.0.0-alpha.1
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/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/client/bootstrap.ts +0 -1
- package/client/index.ts +0 -0
- package/client/pages/action-plan/action-plan-importer.ts +0 -94
- package/client/pages/action-plan/action-plan-list-page.ts +0 -340
- package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
- package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
- package/client/pages/building-inspection/building-inspection-list.ts +0 -565
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
- package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
- package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
- package/client/pages/checklist/attachment-list-popup.ts +0 -301
- package/client/pages/checklist/checklist-view.ts +0 -581
- package/client/pages/checklist/comment-list-popup.ts +0 -328
- package/client/pages/checklist/file-preview-popup.ts +0 -70
- package/client/pages/checklist-template/checklist-template-item.ts +0 -240
- package/client/pages/checklist-template/checklist-template-list.ts +0 -368
- package/client/pages/checklist-template/checklist-type-management.ts +0 -262
- package/client/pages/issue/issue-importer.ts +0 -94
- package/client/pages/issue/issue-list-page.ts +0 -340
- package/client/pages/project-report/project-report-importer.ts +0 -94
- package/client/pages/project-report/project-report-list-page.ts +0 -340
- package/client/pages/supervisor/supervisor-importer.ts +0 -94
- package/client/pages/supervisor/supervisor-list-page.ts +0 -340
- package/client/route.ts +0 -27
- package/client/tsconfig.json +0 -11
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +0 -4
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -28
- package/server/service/action-plan/action-plan-mutation.ts +0 -198
- package/server/service/action-plan/action-plan-query.ts +0 -62
- package/server/service/action-plan/action-plan-type.ts +0 -61
- package/server/service/action-plan/action-plan.ts +0 -103
- package/server/service/action-plan/index.ts +0 -7
- package/server/service/building-inspection/building-inspection-history.ts +0 -72
- package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
- package/server/service/building-inspection/building-inspection-query.ts +0 -242
- package/server/service/building-inspection/building-inspection-type.ts +0 -145
- package/server/service/building-inspection/building-inspection.ts +0 -108
- package/server/service/building-inspection/event-subscriber.ts +0 -20
- package/server/service/building-inspection/index.ts +0 -11
- package/server/service/checklist/checklist-history.ts +0 -96
- package/server/service/checklist/checklist-mutation.ts +0 -103
- package/server/service/checklist/checklist-query.ts +0 -58
- package/server/service/checklist/checklist-type.ts +0 -49
- package/server/service/checklist/checklist.ts +0 -127
- package/server/service/checklist/event-subscriber.ts +0 -17
- package/server/service/checklist/index.ts +0 -9
- package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
- package/server/service/checklist-item/checklist-item-query.ts +0 -84
- package/server/service/checklist-item/checklist-item-type.ts +0 -12
- package/server/service/checklist-item/checklist-item.ts +0 -103
- package/server/service/checklist-item/index.ts +0 -7
- package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
- package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
- package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
- package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
- package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
- package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
- package/server/service/checklist-item-comment/index.ts +0 -9
- package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
- package/server/service/checklist-template/checklist-template-query.ts +0 -39
- package/server/service/checklist-template/checklist-template-type.ts +0 -23
- package/server/service/checklist-template/checklist-template.ts +0 -71
- package/server/service/checklist-template/index.ts +0 -6
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
- package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
- package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
- package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
- package/server/service/checklist-template-item/index.ts +0 -6
- package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
- package/server/service/checklist-type/checklist-type-query.ts +0 -39
- package/server/service/checklist-type/checklist-type-type.ts +0 -26
- package/server/service/checklist-type/checklist-type.ts +0 -64
- package/server/service/checklist-type/index.ts +0 -6
- package/server/service/index.ts +0 -88
- package/server/service/issue/index.ts +0 -7
- package/server/service/issue/issue-mutation.ts +0 -198
- package/server/service/issue/issue-query.ts +0 -62
- package/server/service/issue/issue-type.ts +0 -61
- package/server/service/issue/issue.ts +0 -100
- package/server/service/project-report/index.ts +0 -7
- package/server/service/project-report/project-report-mutation.ts +0 -198
- package/server/service/project-report/project-report-query.ts +0 -62
- package/server/service/project-report/project-report-type.ts +0 -61
- package/server/service/project-report/project-report.ts +0 -113
- package/server/service/supervisor/index.ts +0 -7
- package/server/service/supervisor/supervisor-mutation.ts +0 -198
- package/server/service/supervisor/supervisor-query.ts +0 -62
- package/server/service/supervisor/supervisor-type.ts +0 -61
- package/server/service/supervisor/supervisor.ts +0 -108
- package/server/tsconfig.json +0 -10
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { Checklist } from './checklist'
|
|
4
|
-
import { NewChecklist, ChecklistPatch } from './checklist-type'
|
|
5
|
-
|
|
6
|
-
@Resolver(Checklist)
|
|
7
|
-
export class ChecklistMutation {
|
|
8
|
-
@Directive('@transaction')
|
|
9
|
-
@Mutation(returns => Checklist, { description: 'To create new Checklist' })
|
|
10
|
-
async createChecklist(@Arg('checklist') checklist: NewChecklist, @Ctx() context: ResolverContext): Promise<Checklist> {
|
|
11
|
-
const { domain, user, tx } = context.state
|
|
12
|
-
|
|
13
|
-
const result = await tx.getRepository(Checklist).save({
|
|
14
|
-
...checklist,
|
|
15
|
-
domain,
|
|
16
|
-
creator: user,
|
|
17
|
-
updater: user
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
return result
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Directive('@transaction')
|
|
24
|
-
@Mutation(returns => Checklist, { description: 'To modify Checklist information' })
|
|
25
|
-
async updateChecklist(
|
|
26
|
-
@Arg('id') id: string,
|
|
27
|
-
@Arg('patch') patch: ChecklistPatch,
|
|
28
|
-
@Ctx() context: ResolverContext
|
|
29
|
-
): Promise<Checklist> {
|
|
30
|
-
const { domain, user, tx } = context.state
|
|
31
|
-
|
|
32
|
-
const repository = tx.getRepository(Checklist)
|
|
33
|
-
const checklist = await repository.findOne({
|
|
34
|
-
where: { id }
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const result = await repository.save({
|
|
38
|
-
...checklist,
|
|
39
|
-
...patch,
|
|
40
|
-
updater: user
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return result
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@Directive('@transaction')
|
|
47
|
-
@Mutation(returns => [Checklist], { description: "To modify multiple Checklists' information" })
|
|
48
|
-
async updateMultipleChecklist(
|
|
49
|
-
@Arg('patches', type => [ChecklistPatch]) patches: ChecklistPatch[],
|
|
50
|
-
@Ctx() context: ResolverContext
|
|
51
|
-
): Promise<Checklist[]> {
|
|
52
|
-
const { domain, user, tx } = context.state
|
|
53
|
-
|
|
54
|
-
let results = []
|
|
55
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
56
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
57
|
-
const checklistRepo = tx.getRepository(Checklist)
|
|
58
|
-
|
|
59
|
-
if (_createRecords.length > 0) {
|
|
60
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
61
|
-
const newRecord = _createRecords[i]
|
|
62
|
-
|
|
63
|
-
const result = await checklistRepo.save({
|
|
64
|
-
...newRecord,
|
|
65
|
-
domain,
|
|
66
|
-
creator: user,
|
|
67
|
-
updater: user
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
results.push({ ...result, cuFlag: '+' })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (_updateRecords.length > 0) {
|
|
75
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
76
|
-
const updateRecord = _updateRecords[i]
|
|
77
|
-
const checklist = await checklistRepo.findOneBy({ id: updateRecord.id })
|
|
78
|
-
|
|
79
|
-
const result = await checklistRepo.save({
|
|
80
|
-
...checklist,
|
|
81
|
-
...updateRecord,
|
|
82
|
-
updater: user
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return results
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@Directive('@transaction')
|
|
93
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple Checklists' })
|
|
94
|
-
async deleteChecklists(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
95
|
-
const { domain, tx } = context.state
|
|
96
|
-
|
|
97
|
-
await tx.getRepository(Checklist).softDelete({
|
|
98
|
-
id: In(ids)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
return true
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { Checklist } from './checklist'
|
|
5
|
-
import { ChecklistList } from './checklist-type'
|
|
6
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
7
|
-
import { BuildingInspection } from '../building-inspection/building-inspection'
|
|
8
|
-
|
|
9
|
-
@Resolver(Checklist)
|
|
10
|
-
export class ChecklistQuery {
|
|
11
|
-
@Query(returns => Checklist!, { nullable: true, description: 'To fetch a Checklist' })
|
|
12
|
-
async checklist(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Checklist> {
|
|
13
|
-
const { domain } = context.state
|
|
14
|
-
|
|
15
|
-
return await getRepository(Checklist).findOne({
|
|
16
|
-
where: { id }
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Query(returns => ChecklistList, { description: 'To fetch multiple Checklists' })
|
|
21
|
-
async checklists(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistList> {
|
|
22
|
-
const { domain } = context.state
|
|
23
|
-
|
|
24
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
25
|
-
params,
|
|
26
|
-
repository: await getRepository(Checklist),
|
|
27
|
-
searchables: ['name', 'description']
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
31
|
-
|
|
32
|
-
return { items, total }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@FieldResolver(type => [ChecklistItem])
|
|
36
|
-
async checklistItems(@Root() checklist: Checklist): Promise<ChecklistItem[]> {
|
|
37
|
-
return await getRepository(ChecklistItem)
|
|
38
|
-
.createQueryBuilder('ci')
|
|
39
|
-
.where('ci.checklist_id = :checklistId', { checklistId: checklist.id })
|
|
40
|
-
.orderBy('ci.sequence', 'ASC')
|
|
41
|
-
.getMany()
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@FieldResolver(type => BuildingInspection)
|
|
45
|
-
async buildingInspection(@Root() checklist: Checklist): Promise<BuildingInspection> {
|
|
46
|
-
return await getRepository(BuildingInspection).findOneBy({ checklist: { id: checklist.id } })
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@FieldResolver(type => User)
|
|
50
|
-
async updater(@Root() checklist: Checklist): Promise<User> {
|
|
51
|
-
return await getRepository(User).findOneBy({ id: checklist.updaterId })
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@FieldResolver(type => User)
|
|
55
|
-
async creator(@Root() checklist: Checklist): Promise<User> {
|
|
56
|
-
return await getRepository(User).findOneBy({ id: checklist.creatorId })
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
|
|
2
|
-
import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
|
|
3
|
-
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
|
4
|
-
|
|
5
|
-
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
6
|
-
|
|
7
|
-
import { Checklist } from './checklist'
|
|
8
|
-
|
|
9
|
-
@InputType()
|
|
10
|
-
export class NewChecklist {
|
|
11
|
-
@Field()
|
|
12
|
-
name: string
|
|
13
|
-
|
|
14
|
-
@Field({ nullable: true })
|
|
15
|
-
description?: string
|
|
16
|
-
|
|
17
|
-
@Field({ nullable: true })
|
|
18
|
-
active?: boolean
|
|
19
|
-
|
|
20
|
-
@Field({ nullable: true })
|
|
21
|
-
params?: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@InputType()
|
|
25
|
-
export class ChecklistPatch {
|
|
26
|
-
@Field(type => ID, { nullable: true })
|
|
27
|
-
id?: string
|
|
28
|
-
|
|
29
|
-
@Field({ nullable: true })
|
|
30
|
-
name?: string
|
|
31
|
-
|
|
32
|
-
@Field({ nullable: true })
|
|
33
|
-
description?: string
|
|
34
|
-
|
|
35
|
-
@Field({ nullable: true })
|
|
36
|
-
active?: boolean
|
|
37
|
-
|
|
38
|
-
@Field({ nullable: true })
|
|
39
|
-
cuFlag?: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@ObjectType()
|
|
43
|
-
export class ChecklistList {
|
|
44
|
-
@Field(type => [Checklist])
|
|
45
|
-
items: Checklist[]
|
|
46
|
-
|
|
47
|
-
@Field(type => Int)
|
|
48
|
-
total: number
|
|
49
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
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
|
-
constructionInspectionDate?: Date
|
|
62
|
-
|
|
63
|
-
@Column({ nullable: true, comment: '감리자 점검일' })
|
|
64
|
-
@Field({ nullable: true })
|
|
65
|
-
supervisorInspectionDate?: 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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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]
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { Attachment } from '@things-factory/attachment-base'
|
|
3
|
-
import { 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
|
-
import { ChecklistItemComment } from '../checklist-item-comment/checklist-item-comment'
|
|
8
|
-
import { BuildingInspection } from '../building-inspection/building-inspection'
|
|
9
|
-
|
|
10
|
-
@Resolver(ChecklistItem)
|
|
11
|
-
export class ChecklistItemQuery {
|
|
12
|
-
@Query(returns => ChecklistItem!, { nullable: true, description: 'To fetch a ChecklistItem' })
|
|
13
|
-
async checklistItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ChecklistItem> {
|
|
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 queryBuilder = getQueryBuilderFromListParams({
|
|
22
|
-
params,
|
|
23
|
-
repository: await getRepository(ChecklistItem),
|
|
24
|
-
searchables: ['name', 'description']
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
28
|
-
|
|
29
|
-
return { items, total }
|
|
30
|
-
}
|
|
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
|
-
|
|
42
|
-
@FieldResolver(type => [ChecklistItemComment])
|
|
43
|
-
async checklistItemComments(@Root() checklistItem: ChecklistItem): Promise<ChecklistItemComment[]> {
|
|
44
|
-
return await getRepository(ChecklistItemComment).findBy({ checklistItem: { id: checklistItem.id } })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@FieldResolver(type => Number)
|
|
48
|
-
async checklistItemCommentCount(@Root() checklistItem: ChecklistItem): Promise<number> {
|
|
49
|
-
return await getRepository(ChecklistItemComment).countBy({ checklistItem: { id: checklistItem.id } })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@FieldResolver(type => [Attachment])
|
|
53
|
-
async checklistItemAttachments(@Root() checklistItem: ChecklistItem): Promise<Attachment[]> {
|
|
54
|
-
return await getRepository(Attachment).find({
|
|
55
|
-
where: {
|
|
56
|
-
refType: ChecklistItem.name,
|
|
57
|
-
refBy: checklistItem.id
|
|
58
|
-
},
|
|
59
|
-
order: {
|
|
60
|
-
createdAt: 'DESC'
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@FieldResolver(type => Number)
|
|
66
|
-
async checklistItemAttachmentCount(@Root() checklistItem: ChecklistItem): Promise<number> {
|
|
67
|
-
return await getRepository(Attachment).count({
|
|
68
|
-
where: {
|
|
69
|
-
refType: ChecklistItem.name,
|
|
70
|
-
refBy: checklistItem.id
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@FieldResolver(type => User)
|
|
76
|
-
async updater(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
77
|
-
return await getRepository(User).findOneBy({ id: checklistItem.updaterId })
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
@FieldResolver(type => User)
|
|
81
|
-
async creator(@Root() checklistItem: ChecklistItem): Promise<User> {
|
|
82
|
-
return await getRepository(User).findOneBy({ id: checklistItem.creatorId })
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
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, Int, registerEnumType } from 'type-graphql'
|
|
14
|
-
|
|
15
|
-
import { User } from '@things-factory/auth-base'
|
|
16
|
-
import { Checklist } from '../checklist/checklist'
|
|
17
|
-
import { ChecklistItemComment } from '../checklist-item-comment/checklist-item-comment'
|
|
18
|
-
|
|
19
|
-
export enum ChecklistItemConfirmStatus {
|
|
20
|
-
T = '적합',
|
|
21
|
-
F = '부적합'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
registerEnumType(ChecklistItemConfirmStatus, {
|
|
25
|
-
name: 'ChecklistItemConfirmStatus',
|
|
26
|
-
description: '적합 상태'
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
@Entity({ comment: '체크 리스트 항목' })
|
|
30
|
-
@Index('ix_checklist_item_0', (checklistItem: ChecklistItem) => [checklistItem.checklist], { where: '"deleted_at" IS NULL' })
|
|
31
|
-
@ObjectType()
|
|
32
|
-
export class ChecklistItem {
|
|
33
|
-
@PrimaryGeneratedColumn('uuid')
|
|
34
|
-
@Field(type => ID)
|
|
35
|
-
readonly id: string
|
|
36
|
-
|
|
37
|
-
@Column({ nullable: true, comment: '시퀀스' })
|
|
38
|
-
@Field(type => Int, { nullable: true })
|
|
39
|
-
sequence?: number
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: false, comment: '구분 (텍스트)' })
|
|
42
|
-
@Field({ nullable: false })
|
|
43
|
-
mainType?: string
|
|
44
|
-
|
|
45
|
-
@Column({ nullable: false, comment: '상세 구분 (텍스트)' })
|
|
46
|
-
@Field({ nullable: false })
|
|
47
|
-
detailType?: string
|
|
48
|
-
|
|
49
|
-
@Column({ nullable: true, comment: '검사 항목' })
|
|
50
|
-
@Field({ nullable: true })
|
|
51
|
-
name?: string
|
|
52
|
-
|
|
53
|
-
@Column({ nullable: true, comment: '검사 기준' })
|
|
54
|
-
@Field({ nullable: true })
|
|
55
|
-
inspctionCriteria?: string
|
|
56
|
-
|
|
57
|
-
@Column({ nullable: true, comment: '시공 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
58
|
-
@Field({ nullable: true })
|
|
59
|
-
constructionConfirmStatus?: ChecklistItemConfirmStatus
|
|
60
|
-
|
|
61
|
-
@Column({ nullable: true, comment: '감리 관리자 적합 여부 (T: 적합, F: 부적합)' })
|
|
62
|
-
@Field({ nullable: true })
|
|
63
|
-
supervisoryConfirmStatus?: ChecklistItemConfirmStatus
|
|
64
|
-
|
|
65
|
-
// 조치 사항 정보 (하위 테이블 참조)
|
|
66
|
-
@OneToMany(() => ChecklistItemComment, checklistItemComment => checklistItemComment.checklistItem)
|
|
67
|
-
@Field(() => [ChecklistItemComment])
|
|
68
|
-
checklistItemComments?: ChecklistItemComment[]
|
|
69
|
-
|
|
70
|
-
// 체크리스트 정보 (상위 테이블 참조)
|
|
71
|
-
@ManyToOne(type => Checklist)
|
|
72
|
-
@Field(type => Checklist, { nullable: true })
|
|
73
|
-
checklist?: Checklist
|
|
74
|
-
|
|
75
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.checklist)
|
|
76
|
-
checklistId?: string
|
|
77
|
-
|
|
78
|
-
@CreateDateColumn()
|
|
79
|
-
@Field({ nullable: true })
|
|
80
|
-
createdAt?: Date
|
|
81
|
-
|
|
82
|
-
@UpdateDateColumn()
|
|
83
|
-
@Field({ nullable: true })
|
|
84
|
-
updatedAt?: Date
|
|
85
|
-
|
|
86
|
-
@DeleteDateColumn()
|
|
87
|
-
@Field({ nullable: true })
|
|
88
|
-
deletedAt?: Date
|
|
89
|
-
|
|
90
|
-
@ManyToOne(type => User, { nullable: true })
|
|
91
|
-
@Field(type => User, { nullable: true })
|
|
92
|
-
creator?: User
|
|
93
|
-
|
|
94
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.creator)
|
|
95
|
-
creatorId?: string
|
|
96
|
-
|
|
97
|
-
@ManyToOne(type => User, { nullable: true })
|
|
98
|
-
@Field(type => User, { nullable: true })
|
|
99
|
-
updater?: User
|
|
100
|
-
|
|
101
|
-
@RelationId((checklistItem: ChecklistItem) => checklistItem.updater)
|
|
102
|
-
updaterId?: string
|
|
103
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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 = []
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
-
import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
|
|
3
|
-
import { HistoryActionColumn, HistoryActionType, HistoryEntityInterface, HistoryOriginalIdColumn } from '@operato/typeorm-history'
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import { config } from '@things-factory/env'
|
|
6
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
7
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
8
|
-
|
|
9
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
|
10
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
|
11
|
-
|
|
12
|
-
@Entity()
|
|
13
|
-
@Index('ix_checklist-item-comment_history_0', (checklistItemCommentHistory: ChecklistItemCommentHistory) => [
|
|
14
|
-
checklistItemCommentHistory.originalId
|
|
15
|
-
])
|
|
16
|
-
@Index('ix_checklist-item-comment_history_1', (checklistItemCommentHistory: ChecklistItemCommentHistory) => [
|
|
17
|
-
checklistItemCommentHistory.checklistItem
|
|
18
|
-
])
|
|
19
|
-
@ObjectType({ description: 'History Entity of ChecklistItemComment' })
|
|
20
|
-
export class ChecklistItemCommentHistory implements HistoryEntityInterface<ChecklistItemComment> {
|
|
21
|
-
@PrimaryGeneratedColumn('uuid')
|
|
22
|
-
@Field(type => ID)
|
|
23
|
-
readonly id: string
|
|
24
|
-
|
|
25
|
-
@Column({ nullable: true, comment: '조치 사항 코멘트' })
|
|
26
|
-
@Field({ nullable: true })
|
|
27
|
-
comment?: string
|
|
28
|
-
|
|
29
|
-
// 체크리스트 아이템 정보 (상위 테이블 참조)
|
|
30
|
-
@ManyToOne(type => ChecklistItem)
|
|
31
|
-
@Field(type => ChecklistItem, { nullable: true })
|
|
32
|
-
checklistItem?: ChecklistItem
|
|
33
|
-
|
|
34
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.checklistItem)
|
|
35
|
-
checklistItemId?: string
|
|
36
|
-
|
|
37
|
-
@Column({ nullable: true })
|
|
38
|
-
@Field({ nullable: true })
|
|
39
|
-
createdAt?: Date
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: true })
|
|
42
|
-
@Field({ nullable: true })
|
|
43
|
-
deletedAt?: Date
|
|
44
|
-
|
|
45
|
-
@ManyToOne(type => User, { nullable: true })
|
|
46
|
-
@Field(type => User, { nullable: true })
|
|
47
|
-
creator?: User
|
|
48
|
-
|
|
49
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.creator)
|
|
50
|
-
creatorId?: string
|
|
51
|
-
|
|
52
|
-
@HistoryOriginalIdColumn()
|
|
53
|
-
public originalId!: string
|
|
54
|
-
|
|
55
|
-
@HistoryActionColumn({
|
|
56
|
-
nullable: false,
|
|
57
|
-
type:
|
|
58
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
59
|
-
? 'enum'
|
|
60
|
-
: DATABASE_TYPE == 'oracle'
|
|
61
|
-
? 'varchar2'
|
|
62
|
-
: DATABASE_TYPE == 'mssql'
|
|
63
|
-
? 'nvarchar'
|
|
64
|
-
: 'varchar',
|
|
65
|
-
enum: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? HistoryActionType : undefined,
|
|
66
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32
|
|
67
|
-
})
|
|
68
|
-
public action!: HistoryActionType
|
|
69
|
-
}
|