@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,80 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { getRepository } from '@things-factory/shell'
|
|
3
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
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'
|
|
7
|
-
|
|
8
|
-
@Resolver(ChecklistItemComment)
|
|
9
|
-
export class ChecklistItemCommentMutation {
|
|
10
|
-
@Directive('@transaction')
|
|
11
|
-
@Mutation(returns => ChecklistItemComment, { description: 'To create new ChecklistItemComment' })
|
|
12
|
-
async createChecklistItemComment(
|
|
13
|
-
@Arg('checklistItemComment') checklistItemComment: NewChecklistItemComment,
|
|
14
|
-
@Ctx() context: ResolverContext
|
|
15
|
-
): Promise<ChecklistItemComment> {
|
|
16
|
-
const { user, tx } = context.state
|
|
17
|
-
const { comment, checklistItemId } = checklistItemComment
|
|
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
|
-
|
|
26
|
-
const result = await getRepository(ChecklistItemComment, tx).save({
|
|
27
|
-
comment,
|
|
28
|
-
checklistItem: { id: checklistItemId },
|
|
29
|
-
createdAt: new Date(),
|
|
30
|
-
creator: user,
|
|
31
|
-
updater: user
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
return result
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@Directive('@transaction')
|
|
38
|
-
@Mutation(returns => ChecklistItemComment, { description: 'To modify ChecklistItemComment information' })
|
|
39
|
-
async updateChecklistItemComment(
|
|
40
|
-
@Arg('id') id: string,
|
|
41
|
-
@Arg('patch') patch: ChecklistItemCommentPatch,
|
|
42
|
-
@Ctx() context: ResolverContext
|
|
43
|
-
): Promise<ChecklistItemComment> {
|
|
44
|
-
const { user, tx } = context.state
|
|
45
|
-
|
|
46
|
-
const repository = getRepository(ChecklistItemComment, tx)
|
|
47
|
-
const checklistItemComment = await repository.findOne({
|
|
48
|
-
where: { id }
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const result = await repository.save({
|
|
52
|
-
...checklistItemComment,
|
|
53
|
-
...patch,
|
|
54
|
-
updater: user
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
return result
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Directive('@transaction')
|
|
61
|
-
@Mutation(returns => Boolean, { description: 'To delete ChecklistItemComment' })
|
|
62
|
-
async deleteChecklistItemComment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
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
|
-
}
|
|
75
|
-
|
|
76
|
-
await repository.softDelete({ id })
|
|
77
|
-
|
|
78
|
-
return true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { getRepository, Pagination } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
5
|
-
|
|
6
|
-
@Resolver(ChecklistItemComment)
|
|
7
|
-
export class ChecklistItemCommentQuery {
|
|
8
|
-
@Query(returns => [ChecklistItemComment], { description: 'To fetch multiple ChecklistItemComments' })
|
|
9
|
-
async checklistItemComments(
|
|
10
|
-
@Arg('checklistItemId') checklistItemId: string,
|
|
11
|
-
@Arg('pagination') pagination: Pagination,
|
|
12
|
-
@Ctx() context: ResolverContext
|
|
13
|
-
): Promise<ChecklistItemComment[]> {
|
|
14
|
-
const { limit, page } = pagination
|
|
15
|
-
|
|
16
|
-
// 페이지네이션을 위한 offset 계산
|
|
17
|
-
const offset = (page - 1) * limit
|
|
18
|
-
|
|
19
|
-
// 코멘트와 총 개수를 가져오는 쿼리
|
|
20
|
-
const items = await getRepository(ChecklistItemComment)
|
|
21
|
-
.createQueryBuilder('cic')
|
|
22
|
-
.innerJoin('cic.checklistItem', 'ci')
|
|
23
|
-
.where('cic.checklistItem = :checklistItemId', { checklistItemId })
|
|
24
|
-
.skip(offset)
|
|
25
|
-
.take(limit)
|
|
26
|
-
.orderBy('cic.createdAt', 'DESC')
|
|
27
|
-
.getMany()
|
|
28
|
-
|
|
29
|
-
return items
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@FieldResolver(type => User)
|
|
33
|
-
async creator(@Root() checklistItemComment: ChecklistItemComment): Promise<User> {
|
|
34
|
-
return checklistItemComment.creatorId && (await getRepository(User).findOneBy({ id: checklistItemComment.creatorId }))
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
export class NewChecklistItemComment {
|
|
6
|
-
@Field({ nullable: true })
|
|
7
|
-
comment?: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: true })
|
|
10
|
-
checklistItemId?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@InputType()
|
|
14
|
-
export class ChecklistItemCommentPatch {
|
|
15
|
-
@Field(type => ID, { nullable: true })
|
|
16
|
-
id?: string
|
|
17
|
-
|
|
18
|
-
@Field({ nullable: true })
|
|
19
|
-
comment?: string
|
|
20
|
-
|
|
21
|
-
@Field({ nullable: true })
|
|
22
|
-
checklistItemId?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@ObjectType()
|
|
26
|
-
export class ChecklistItemCommentList {
|
|
27
|
-
@Field(type => [ChecklistItemComment])
|
|
28
|
-
items: ChecklistItemComment[]
|
|
29
|
-
|
|
30
|
-
@Field(type => Int)
|
|
31
|
-
total: number
|
|
32
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 } from 'type-graphql'
|
|
13
|
-
import { User } from '@things-factory/auth-base'
|
|
14
|
-
import { ChecklistItem } from '../checklist-item/checklist-item'
|
|
15
|
-
|
|
16
|
-
@Entity()
|
|
17
|
-
@Index(
|
|
18
|
-
'ix_checklist_item_comment_0',
|
|
19
|
-
(checklistItemComment: ChecklistItemComment) => [checklistItemComment.checklistItem, checklistItemComment.createdAt],
|
|
20
|
-
{
|
|
21
|
-
where: '"deleted_at" IS NULL'
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
@ObjectType({ description: 'Entity for ChecklistItemComment' })
|
|
25
|
-
export class ChecklistItemComment {
|
|
26
|
-
@PrimaryGeneratedColumn('uuid')
|
|
27
|
-
@Field(type => ID)
|
|
28
|
-
readonly id: string
|
|
29
|
-
|
|
30
|
-
@Column({ nullable: true, comment: '조치 사항 코멘트' })
|
|
31
|
-
@Field({ nullable: true })
|
|
32
|
-
comment?: string
|
|
33
|
-
|
|
34
|
-
// 체크리스트 아이템 정보 (상위 테이블 참조)
|
|
35
|
-
@ManyToOne(type => ChecklistItem)
|
|
36
|
-
@Field(type => ChecklistItem, { nullable: true })
|
|
37
|
-
checklistItem?: ChecklistItem
|
|
38
|
-
|
|
39
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.checklistItem)
|
|
40
|
-
checklistItemId?: string
|
|
41
|
-
|
|
42
|
-
@CreateDateColumn()
|
|
43
|
-
@Field({ nullable: true })
|
|
44
|
-
createdAt?: Date
|
|
45
|
-
|
|
46
|
-
@DeleteDateColumn()
|
|
47
|
-
@Field({ nullable: true })
|
|
48
|
-
deletedAt?: Date
|
|
49
|
-
|
|
50
|
-
@ManyToOne(type => User, { nullable: true })
|
|
51
|
-
@Field(type => User, { nullable: true })
|
|
52
|
-
creator?: User
|
|
53
|
-
|
|
54
|
-
@RelationId((checklistItemComment: ChecklistItemComment) => checklistItemComment.creator)
|
|
55
|
-
creatorId?: string
|
|
56
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EventSubscriber } from 'typeorm'
|
|
2
|
-
|
|
3
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
|
4
|
-
|
|
5
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
6
|
-
import { ChecklistItemCommentHistory } from './checklist-item-comment-history'
|
|
7
|
-
|
|
8
|
-
@EventSubscriber()
|
|
9
|
-
export class ChecklistItemCommentHistoryEntitySubscriber extends HistoryEntitySubscriber<ChecklistItemComment, ChecklistItemCommentHistory> {
|
|
10
|
-
public get entity() {
|
|
11
|
-
return ChecklistItemComment
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public get historyEntity() {
|
|
15
|
-
return ChecklistItemCommentHistory
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ChecklistItemComment } from './checklist-item-comment'
|
|
2
|
-
import { ChecklistItemCommentHistory } from './checklist-item-comment-history'
|
|
3
|
-
import { ChecklistItemCommentHistoryEntitySubscriber } from './event-subscriber'
|
|
4
|
-
import { ChecklistItemCommentQuery } from './checklist-item-comment-query'
|
|
5
|
-
import { ChecklistItemCommentMutation } from './checklist-item-comment-mutation'
|
|
6
|
-
|
|
7
|
-
export const entities = [ChecklistItemComment, ChecklistItemCommentHistory]
|
|
8
|
-
export const resolvers = [ChecklistItemCommentQuery, ChecklistItemCommentMutation]
|
|
9
|
-
export const subscribers = [ChecklistItemCommentHistoryEntitySubscriber]
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,71 +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 } 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
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
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]
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,44 +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 { ChecklistTemplateItem } from './checklist-template-item'
|
|
5
|
-
import { ChecklistTemplateItemList } from './checklist-template-item-type'
|
|
6
|
-
import { ChecklistType } from '../checklist-type/checklist-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(ChecklistTemplateItem)
|
|
9
|
-
export class ChecklistTemplateItemQuery {
|
|
10
|
-
@Query(returns => ChecklistTemplateItem!, { nullable: true, description: 'To fetch a ChecklistTemplateItem' })
|
|
11
|
-
async checklistTemplateItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ChecklistTemplateItem> {
|
|
12
|
-
return await getRepository(ChecklistTemplateItem).findOne({
|
|
13
|
-
where: { id }
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@Query(returns => ChecklistTemplateItemList, { description: 'To fetch multiple ChecklistTemplateItems' })
|
|
18
|
-
async checklistTemplateItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistTemplateItemList> {
|
|
19
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
20
|
-
params,
|
|
21
|
-
repository: await getRepository(ChecklistTemplateItem),
|
|
22
|
-
searchables: ['name', 'description']
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
26
|
-
|
|
27
|
-
return { items, total }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@FieldResolver(type => String)
|
|
31
|
-
async detailTypeName(@Root() checklistTemplateItem: ChecklistTemplateItem): Promise<string> {
|
|
32
|
-
return (await getRepository(ChecklistType).findOneBy({ id: checklistTemplateItem.detailType }))?.detailType || ''
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@FieldResolver(type => User)
|
|
36
|
-
async updater(@Root() checklistTemplateItem: ChecklistTemplateItem): Promise<User> {
|
|
37
|
-
return await getRepository(User).findOneBy({ id: checklistTemplateItem.updaterId })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@FieldResolver(type => User)
|
|
41
|
-
async creator(@Root() checklistTemplateItem: ChecklistTemplateItem): Promise<User> {
|
|
42
|
-
return await getRepository(User).findOneBy({ id: checklistTemplateItem.creatorId })
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { ChecklistTemplateItem } from './checklist-template-item'
|
|
3
|
-
import { ChecklistTypeMainType } from '../checklist-type/checklist-type'
|
|
4
|
-
|
|
5
|
-
@InputType()
|
|
6
|
-
export class ChecklistTemplateItemPatch {
|
|
7
|
-
@Field(type => ID, { nullable: true })
|
|
8
|
-
id?: string
|
|
9
|
-
|
|
10
|
-
@Field({ nullable: true })
|
|
11
|
-
name?: string
|
|
12
|
-
|
|
13
|
-
@Field({ nullable: true })
|
|
14
|
-
inspctionCriteria?: string
|
|
15
|
-
|
|
16
|
-
@Field(type => Int, { nullable: true })
|
|
17
|
-
sequence?: number
|
|
18
|
-
|
|
19
|
-
@Field({ nullable: true })
|
|
20
|
-
mainType?: ChecklistTypeMainType
|
|
21
|
-
|
|
22
|
-
@Field({ nullable: true })
|
|
23
|
-
detailType?: string
|
|
24
|
-
|
|
25
|
-
@Field({ nullable: true })
|
|
26
|
-
checklistTemplateId?: string
|
|
27
|
-
|
|
28
|
-
@Field({ nullable: true })
|
|
29
|
-
cuFlag?: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@ObjectType()
|
|
33
|
-
export class ChecklistTemplateItemList {
|
|
34
|
-
@Field(type => [ChecklistTemplateItem])
|
|
35
|
-
items: ChecklistTemplateItem[]
|
|
36
|
-
|
|
37
|
-
@Field(type => Int)
|
|
38
|
-
total: number
|
|
39
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
|
3
|
-
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
import { ChecklistTemplate } from '../checklist-template/checklist-template'
|
|
6
|
-
import { ChecklistTypeMainType } from '../checklist-type/checklist-type'
|
|
7
|
-
|
|
8
|
-
@Entity({ comment: '체크리스트 템플릿 아이템' })
|
|
9
|
-
@Index('ix_checklist_template_item_0', (checklistTemplateItem: ChecklistTemplateItem) => [checklistTemplateItem.name], {
|
|
10
|
-
unique: true
|
|
11
|
-
})
|
|
12
|
-
@Index('ix_checklist_template_item_1', (checklistTemplateItem: ChecklistTemplateItem) => [checklistTemplateItem.detailType])
|
|
13
|
-
@ObjectType()
|
|
14
|
-
export class ChecklistTemplateItem {
|
|
15
|
-
@PrimaryGeneratedColumn('uuid')
|
|
16
|
-
@Field(type => ID)
|
|
17
|
-
readonly id: string
|
|
18
|
-
|
|
19
|
-
@Column({ nullable: false, comment: '검사 항목' })
|
|
20
|
-
@Field({ nullable: false })
|
|
21
|
-
name: string
|
|
22
|
-
|
|
23
|
-
@Column({ nullable: true, comment: '검사 기준' })
|
|
24
|
-
@Field({ nullable: true })
|
|
25
|
-
inspctionCriteria?: string
|
|
26
|
-
|
|
27
|
-
@Column({ nullable: true, comment: '시퀀스' })
|
|
28
|
-
@Field(type => Int, { nullable: true })
|
|
29
|
-
sequence?: number
|
|
30
|
-
|
|
31
|
-
@Column({ nullable: false, comment: '메인 구분 (10: 기본 업무, 20: 기본 외 업무)' })
|
|
32
|
-
@Field({ nullable: false })
|
|
33
|
-
mainType: ChecklistTypeMainType
|
|
34
|
-
|
|
35
|
-
@Column({ nullable: false, comment: '상세 구분 ID (F.K)' })
|
|
36
|
-
@Field({ nullable: false })
|
|
37
|
-
detailType: string
|
|
38
|
-
|
|
39
|
-
// 체크리스트 템플릿 정보 (상위 테이블 참조)
|
|
40
|
-
@ManyToOne(type => ChecklistTemplate)
|
|
41
|
-
@Field(type => ChecklistTemplate, { nullable: true })
|
|
42
|
-
checklistTemplate?: ChecklistTemplate
|
|
43
|
-
|
|
44
|
-
@RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.checklistTemplate)
|
|
45
|
-
checklistTemplateId?: string
|
|
46
|
-
|
|
47
|
-
@CreateDateColumn()
|
|
48
|
-
@Field({ nullable: true })
|
|
49
|
-
createdAt?: Date
|
|
50
|
-
|
|
51
|
-
@UpdateDateColumn()
|
|
52
|
-
@Field({ nullable: true })
|
|
53
|
-
updatedAt?: Date
|
|
54
|
-
|
|
55
|
-
@ManyToOne(type => User, { nullable: true })
|
|
56
|
-
@Field(type => User, { nullable: true })
|
|
57
|
-
creator?: User
|
|
58
|
-
|
|
59
|
-
@RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.creator)
|
|
60
|
-
creatorId?: string
|
|
61
|
-
|
|
62
|
-
@ManyToOne(type => User, { nullable: true })
|
|
63
|
-
@Field(type => User, { nullable: true })
|
|
64
|
-
updater?: User
|
|
65
|
-
|
|
66
|
-
@RelationId((checklistTemplateItem: ChecklistTemplateItem) => checklistTemplateItem.updater)
|
|
67
|
-
updaterId?: string
|
|
68
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ChecklistTemplateItem } from './checklist-template-item'
|
|
2
|
-
import { ChecklistTemplateItemQuery } from './checklist-template-item-query'
|
|
3
|
-
import { ChecklistTemplateItemMutation } from './checklist-template-item-mutation'
|
|
4
|
-
|
|
5
|
-
export const entities = [ChecklistTemplateItem]
|
|
6
|
-
export const resolvers = [ChecklistTemplateItemQuery, ChecklistTemplateItemMutation]
|