@dssp/project 0.0.2
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/CHANGELOG.md +8 -0
- package/assets/images/hatiolab-logo.png +0 -0
- package/assets/images/o-mark.png +0 -0
- package/assets/images/x-mark.png +0 -0
- package/client/bootstrap.ts +0 -0
- package/client/index.ts +0 -0
- package/client/pages/checklist/checklist-importer.ts +96 -0
- package/client/pages/checklist/checklist-list-page.ts +355 -0
- package/client/pages/lib/waether.ts +159 -0
- package/client/pages/project/ox-progress-circle.ts +133 -0
- package/client/pages/project/project-create-popup.ts +148 -0
- package/client/pages/project/project-detail.ts +618 -0
- package/client/pages/project/project-list.ts +354 -0
- package/client/pages/project/project-plan-management.ts +437 -0
- package/client/pages/project/project-schedule-list.ts +280 -0
- package/client/pages/project/project-schedule.ts +248 -0
- package/client/pages/project/project-setting-list.ts +298 -0
- package/client/pages/project/project-update.ts +797 -0
- package/client/pages/resource/resource-importer.ts +96 -0
- package/client/pages/resource/resource-list-page.ts +355 -0
- package/client/pages/task/task-importer.ts +96 -0
- package/client/pages/task/task-list-page.ts +355 -0
- package/client/route.ts +39 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/bootstrap.d.ts +0 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/checklist/checklist-importer.d.ts +9 -0
- package/dist-client/pages/checklist/checklist-importer.js +100 -0
- package/dist-client/pages/checklist/checklist-importer.js.map +1 -0
- package/dist-client/pages/checklist/checklist-list-page.d.ts +62 -0
- package/dist-client/pages/checklist/checklist-list-page.js +331 -0
- package/dist-client/pages/checklist/checklist-list-page.js.map +1 -0
- package/dist-client/pages/lib/waether.d.ts +6 -0
- package/dist-client/pages/lib/waether.js +152 -0
- package/dist-client/pages/lib/waether.js.map +1 -0
- package/dist-client/pages/project/ox-progress-circle.d.ts +41 -0
- package/dist-client/pages/project/ox-progress-circle.js +182 -0
- package/dist-client/pages/project/ox-progress-circle.js.map +1 -0
- package/dist-client/pages/project/project-create-popup.d.ts +14 -0
- package/dist-client/pages/project/project-create-popup.js +153 -0
- package/dist-client/pages/project/project-create-popup.js.map +1 -0
- package/dist-client/pages/project/project-detail.d.ts +35 -0
- package/dist-client/pages/project/project-detail.js +617 -0
- package/dist-client/pages/project/project-detail.js.map +1 -0
- package/dist-client/pages/project/project-list.d.ts +88 -0
- package/dist-client/pages/project/project-list.js +303 -0
- package/dist-client/pages/project/project-list.js.map +1 -0
- package/dist-client/pages/project/project-plan-management.d.ts +27 -0
- package/dist-client/pages/project/project-plan-management.js +438 -0
- package/dist-client/pages/project/project-plan-management.js.map +1 -0
- package/dist-client/pages/project/project-schedule-list.d.ts +18 -0
- package/dist-client/pages/project/project-schedule-list.js +292 -0
- package/dist-client/pages/project/project-schedule-list.js.map +1 -0
- package/dist-client/pages/project/project-schedule.d.ts +23 -0
- package/dist-client/pages/project/project-schedule.js +256 -0
- package/dist-client/pages/project/project-schedule.js.map +1 -0
- package/dist-client/pages/project/project-setting-list.d.ts +23 -0
- package/dist-client/pages/project/project-setting-list.js +307 -0
- package/dist-client/pages/project/project-setting-list.js.map +1 -0
- package/dist-client/pages/project/project-update.d.ts +24 -0
- package/dist-client/pages/project/project-update.js +797 -0
- package/dist-client/pages/project/project-update.js.map +1 -0
- package/dist-client/pages/resource/resource-importer.d.ts +9 -0
- package/dist-client/pages/resource/resource-importer.js +100 -0
- package/dist-client/pages/resource/resource-importer.js.map +1 -0
- package/dist-client/pages/resource/resource-list-page.d.ts +62 -0
- package/dist-client/pages/resource/resource-list-page.js +331 -0
- package/dist-client/pages/resource/resource-list-page.js.map +1 -0
- package/dist-client/pages/task/task-importer.d.ts +9 -0
- package/dist-client/pages/task/task-importer.js +100 -0
- package/dist-client/pages/task/task-importer.js.map +1 -0
- package/dist-client/pages/task/task-list-page.d.ts +62 -0
- package/dist-client/pages/task/task-list-page.js +331 -0
- package/dist-client/pages/task/task-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +32 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/project-to-excel.js +30 -0
- package/dist-server/controllers/project-to-excel.js.map +1 -0
- package/dist-server/index.js +6 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/routes.js +105 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/check-item/check-item-mutation.js +129 -0
- package/dist-server/service/check-item/check-item-mutation.js.map +1 -0
- package/dist-server/service/check-item/check-item-query.js +86 -0
- package/dist-server/service/check-item/check-item-query.js.map +1 -0
- package/dist-server/service/check-item/check-item-type.js +69 -0
- package/dist-server/service/check-item/check-item-type.js.map +1 -0
- package/dist-server/service/check-item/check-item.js +84 -0
- package/dist-server/service/check-item/check-item.js.map +1 -0
- package/dist-server/service/check-item/index.js +9 -0
- package/dist-server/service/check-item/index.js.map +1 -0
- package/dist-server/service/checklist/checklist-mutation.js +129 -0
- package/dist-server/service/checklist/checklist-mutation.js.map +1 -0
- package/dist-server/service/checklist/checklist-query.js +86 -0
- package/dist-server/service/checklist/checklist-query.js.map +1 -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.js +120 -0
- package/dist-server/service/checklist/checklist.js.map +1 -0
- package/dist-server/service/checklist/index.js +9 -0
- package/dist-server/service/checklist/index.js.map +1 -0
- package/dist-server/service/index.js +36 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/project/index.js +11 -0
- package/dist-server/service/project/index.js.map +1 -0
- package/dist-server/service/project/project-mutation.js +190 -0
- package/dist-server/service/project/project-mutation.js.map +1 -0
- package/dist-server/service/project/project-query.js +143 -0
- package/dist-server/service/project/project-query.js.map +1 -0
- package/dist-server/service/project/project-type.js +106 -0
- package/dist-server/service/project/project-type.js.map +1 -0
- package/dist-server/service/project/project.js +146 -0
- package/dist-server/service/project/project.js.map +1 -0
- package/dist-server/service/resource/index.js +9 -0
- package/dist-server/service/resource/index.js.map +1 -0
- package/dist-server/service/resource/resource-mutation.js +129 -0
- package/dist-server/service/resource/resource-mutation.js.map +1 -0
- package/dist-server/service/resource/resource-query.js +86 -0
- package/dist-server/service/resource/resource-query.js.map +1 -0
- package/dist-server/service/resource/resource-type.js +69 -0
- package/dist-server/service/resource/resource-type.js.map +1 -0
- package/dist-server/service/resource/resource.js +62 -0
- package/dist-server/service/resource/resource.js.map +1 -0
- package/dist-server/service/task/index.js +9 -0
- package/dist-server/service/task/index.js.map +1 -0
- package/dist-server/service/task/task-mutation.js +129 -0
- package/dist-server/service/task/task-mutation.js.map +1 -0
- package/dist-server/service/task/task-query.js +86 -0
- package/dist-server/service/task/task-query.js.map +1 -0
- package/dist-server/service/task/task-type.js +69 -0
- package/dist-server/service/task/task-type.js.map +1 -0
- package/dist-server/service/task/task.js +106 -0
- package/dist-server/service/task/task.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/management/alarm.md +160 -0
- package/helps/management/alter-video.md +160 -0
- package/helps/management/cctv.md +160 -0
- package/helps/management/device.md +160 -0
- package/helps/management/parking.md +160 -0
- package/helps/management/site.md +160 -0
- package/helps/management/sun-pnl.md +160 -0
- package/helps/project/checklist.md +160 -0
- package/helps/project/project.md +160 -0
- package/helps/project/resource.md +160 -0
- package/helps/project/task.md +160 -0
- package/package.json +38 -0
- package/server/controllers/index.ts +0 -0
- package/server/controllers/project-to-excel.ts +40 -0
- package/server/index.ts +3 -0
- package/server/middlewares/index.ts +3 -0
- package/server/routes.ts +108 -0
- package/server/service/check-item/check-item-mutation.ts +142 -0
- package/server/service/check-item/check-item-query.ts +56 -0
- package/server/service/check-item/check-item-type.ts +49 -0
- package/server/service/check-item/check-item.ts +74 -0
- package/server/service/check-item/index.ts +6 -0
- package/server/service/checklist/checklist-mutation.ts +142 -0
- package/server/service/checklist/checklist-query.ts +56 -0
- package/server/service/checklist/checklist-type.ts +49 -0
- package/server/service/checklist/checklist.ts +105 -0
- package/server/service/checklist/index.ts +6 -0
- package/server/service/index.ts +35 -0
- package/server/service/project/index.ts +8 -0
- package/server/service/project/project-mutation.ts +201 -0
- package/server/service/project/project-query.ts +103 -0
- package/server/service/project/project-type.ts +71 -0
- package/server/service/project/project.ts +131 -0
- package/server/service/resource/index.ts +6 -0
- package/server/service/resource/resource-mutation.ts +139 -0
- package/server/service/resource/resource-query.ts +56 -0
- package/server/service/resource/resource-type.ts +49 -0
- package/server/service/resource/resource.ts +56 -0
- package/server/service/task/index.ts +6 -0
- package/server/service/task/task-mutation.ts +136 -0
- package/server/service/task/task-query.ts +56 -0
- package/server/service/task/task-type.ts +49 -0
- package/server/service/task/task.ts +97 -0
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +20 -0
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +9 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
+
|
|
6
|
+
import { CheckItem } from './check-item'
|
|
7
|
+
import { NewCheckItem, CheckItemPatch } from './check-item-type'
|
|
8
|
+
|
|
9
|
+
@Resolver(CheckItem)
|
|
10
|
+
export class CheckItemMutation {
|
|
11
|
+
@Directive('@transaction')
|
|
12
|
+
@Mutation(returns => CheckItem, { description: 'To create new CheckItem' })
|
|
13
|
+
async createCheckItem(
|
|
14
|
+
@Arg('checkItem') checkItem: NewCheckItem,
|
|
15
|
+
@Ctx() context: ResolverContext
|
|
16
|
+
): Promise<CheckItem> {
|
|
17
|
+
const { domain, user, tx } = context.state
|
|
18
|
+
|
|
19
|
+
const result = await tx.getRepository(CheckItem).save({
|
|
20
|
+
...checkItem,
|
|
21
|
+
domain,
|
|
22
|
+
creator: user,
|
|
23
|
+
updater: user
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Directive('@transaction')
|
|
30
|
+
@Mutation(returns => CheckItem, { description: 'To modify CheckItem information' })
|
|
31
|
+
async updateCheckItem(
|
|
32
|
+
@Arg('id') id: string,
|
|
33
|
+
@Arg('patch') patch: CheckItemPatch,
|
|
34
|
+
@Ctx() context: ResolverContext
|
|
35
|
+
): Promise<CheckItem> {
|
|
36
|
+
const { domain, user, tx } = context.state
|
|
37
|
+
|
|
38
|
+
const repository = tx.getRepository(CheckItem)
|
|
39
|
+
const checkItem = await repository.findOne({
|
|
40
|
+
where: { id }
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const result = await repository.save({
|
|
44
|
+
...checkItem,
|
|
45
|
+
...patch,
|
|
46
|
+
updater: user
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return result
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Directive('@transaction')
|
|
53
|
+
@Mutation(returns => [CheckItem], { description: "To modify multiple CheckItems' information" })
|
|
54
|
+
async updateMultipleCheckItem(
|
|
55
|
+
@Arg('patches', type => [CheckItemPatch]) patches: CheckItemPatch[],
|
|
56
|
+
@Ctx() context: ResolverContext
|
|
57
|
+
): Promise<CheckItem[]> {
|
|
58
|
+
const { domain, user, tx } = context.state
|
|
59
|
+
|
|
60
|
+
let results = []
|
|
61
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
62
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
63
|
+
const checkItemRepo = tx.getRepository(CheckItem)
|
|
64
|
+
|
|
65
|
+
if (_createRecords.length > 0) {
|
|
66
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
67
|
+
const newRecord = _createRecords[i]
|
|
68
|
+
|
|
69
|
+
const result = await checkItemRepo.save({
|
|
70
|
+
...newRecord,
|
|
71
|
+
domain,
|
|
72
|
+
creator: user,
|
|
73
|
+
updater: user
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
results.push({ ...result, cuFlag: '+' })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (_updateRecords.length > 0) {
|
|
81
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
82
|
+
const updateRecord = _updateRecords[i]
|
|
83
|
+
const checkItem = await checkItemRepo.findOneBy({ id: updateRecord.id })
|
|
84
|
+
|
|
85
|
+
const result = await checkItemRepo.save({
|
|
86
|
+
...checkItem,
|
|
87
|
+
...updateRecord,
|
|
88
|
+
updater: user
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return results
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Directive('@transaction')
|
|
99
|
+
@Mutation(returns => Boolean, { description: 'To delete CheckItem' })
|
|
100
|
+
async deleteCheckItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
101
|
+
const { domain, tx } = context.state
|
|
102
|
+
|
|
103
|
+
await tx.getRepository(CheckItem).delete({ id })
|
|
104
|
+
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
105
|
+
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Directive('@transaction')
|
|
110
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple CheckItems' })
|
|
111
|
+
async deleteCheckItems(
|
|
112
|
+
@Arg('ids', type => [String]) ids: string[],
|
|
113
|
+
@Ctx() context: ResolverContext
|
|
114
|
+
): Promise<boolean> {
|
|
115
|
+
const { domain, tx } = context.state
|
|
116
|
+
|
|
117
|
+
await tx.getRepository(CheckItem).delete({
|
|
118
|
+
id: In(ids)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
122
|
+
|
|
123
|
+
return true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Directive('@transaction')
|
|
127
|
+
@Mutation(returns => Boolean, { description: 'To import multiple CheckItems' })
|
|
128
|
+
async importCheckItems(
|
|
129
|
+
@Arg('checkItems', type => [CheckItemPatch]) checkItems: CheckItemPatch[],
|
|
130
|
+
@Ctx() context: ResolverContext
|
|
131
|
+
): Promise<boolean> {
|
|
132
|
+
const { domain, tx } = context.state
|
|
133
|
+
|
|
134
|
+
await Promise.all(
|
|
135
|
+
checkItems.map(async (checkItem: CheckItemPatch) => {
|
|
136
|
+
const createdCheckItem: CheckItem = await tx.getRepository(CheckItem).save({ domain, ...checkItem })
|
|
137
|
+
})
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return true
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { CheckItem } from './check-item'
|
|
6
|
+
import { CheckItemList } from './check-item-type'
|
|
7
|
+
|
|
8
|
+
@Resolver(CheckItem)
|
|
9
|
+
export class CheckItemQuery {
|
|
10
|
+
@Query(returns => CheckItem!, { nullable: true, description: 'To fetch a CheckItem' })
|
|
11
|
+
async checkItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<CheckItem> {
|
|
12
|
+
const { domain } = context.state
|
|
13
|
+
|
|
14
|
+
return await getRepository(CheckItem).findOne({
|
|
15
|
+
where: { id }
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Query(returns => CheckItemList, { description: 'To fetch multiple CheckItems' })
|
|
20
|
+
async checkItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<CheckItemList> {
|
|
21
|
+
const { domain } = context.state
|
|
22
|
+
|
|
23
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
24
|
+
domain,
|
|
25
|
+
params,
|
|
26
|
+
repository: await getRepository(CheckItem),
|
|
27
|
+
searchables: ['name', 'description']
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
31
|
+
|
|
32
|
+
return { items, total }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@FieldResolver(type => String)
|
|
36
|
+
async thumbnail(@Root() checkItem: CheckItem): Promise<string | undefined> {
|
|
37
|
+
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
38
|
+
where: {
|
|
39
|
+
refType: CheckItem.name,
|
|
40
|
+
refBy: checkItem.id
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return attachment?.fullpath
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@FieldResolver(type => User)
|
|
48
|
+
async updater(@Root() checkItem: CheckItem): Promise<User> {
|
|
49
|
+
return await getRepository(User).findOneBy({ id: checkItem.updaterId })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@FieldResolver(type => User)
|
|
53
|
+
async creator(@Root() checkItem: CheckItem): Promise<User> {
|
|
54
|
+
return await getRepository(User).findOneBy({ id: checkItem.creatorId })
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { CheckItem } from './check-item'
|
|
8
|
+
|
|
9
|
+
@InputType()
|
|
10
|
+
export class NewCheckItem {
|
|
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 CheckItemPatch {
|
|
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 CheckItemList {
|
|
44
|
+
@Field(type => [CheckItem])
|
|
45
|
+
items: CheckItem[]
|
|
46
|
+
|
|
47
|
+
@Field(type => Int)
|
|
48
|
+
total: number
|
|
49
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
|
|
14
|
+
import { User } from '@things-factory/auth-base'
|
|
15
|
+
import { Checklist } from '../checklist/checklist'
|
|
16
|
+
|
|
17
|
+
@Entity()
|
|
18
|
+
@Index('ix_check_item_0', (checkItem: CheckItem) => [checkItem.checklist], { where: '"deleted_at" IS NULL' })
|
|
19
|
+
@ObjectType({ description: '체크 리스트 항목' })
|
|
20
|
+
export class CheckItem {
|
|
21
|
+
@PrimaryGeneratedColumn('uuid')
|
|
22
|
+
@Field(type => ID)
|
|
23
|
+
readonly id: string
|
|
24
|
+
|
|
25
|
+
@Column({ nullable: true, comment: '검사 항목' })
|
|
26
|
+
@Field({ nullable: true })
|
|
27
|
+
name?: string
|
|
28
|
+
|
|
29
|
+
@Column({ nullable: true, comment: '검사 결과 (true: 적합, false: 부적합)' })
|
|
30
|
+
@Field({ nullable: true })
|
|
31
|
+
result?: boolean
|
|
32
|
+
|
|
33
|
+
@Column({ nullable: true, comment: '기준, 참고 사항 이미지' })
|
|
34
|
+
@Field({ nullable: true })
|
|
35
|
+
reference?: string
|
|
36
|
+
|
|
37
|
+
@Column({ nullable: true, comment: '조치 사항' })
|
|
38
|
+
@Field({ nullable: true })
|
|
39
|
+
measuresToBeTaken?: string
|
|
40
|
+
|
|
41
|
+
// 체크리스트 정보 (상위 테이블 참조)
|
|
42
|
+
@ManyToOne(type => Checklist)
|
|
43
|
+
@Field({ nullable: true })
|
|
44
|
+
checklist?: Checklist
|
|
45
|
+
|
|
46
|
+
@RelationId((checkItem: CheckItem) => checkItem.checklist)
|
|
47
|
+
checklistId?: string
|
|
48
|
+
|
|
49
|
+
@CreateDateColumn()
|
|
50
|
+
@Field({ nullable: true })
|
|
51
|
+
createdAt?: Date
|
|
52
|
+
|
|
53
|
+
@UpdateDateColumn()
|
|
54
|
+
@Field({ nullable: true })
|
|
55
|
+
updatedAt?: Date
|
|
56
|
+
|
|
57
|
+
@DeleteDateColumn()
|
|
58
|
+
@Field({ nullable: true })
|
|
59
|
+
deletedAt?: Date
|
|
60
|
+
|
|
61
|
+
@ManyToOne(type => User, { nullable: true })
|
|
62
|
+
@Field(type => User, { nullable: true })
|
|
63
|
+
creator?: User
|
|
64
|
+
|
|
65
|
+
@RelationId((checkItem: CheckItem) => checkItem.creator)
|
|
66
|
+
creatorId?: string
|
|
67
|
+
|
|
68
|
+
@ManyToOne(type => User, { nullable: true })
|
|
69
|
+
@Field(type => User, { nullable: true })
|
|
70
|
+
updater?: User
|
|
71
|
+
|
|
72
|
+
@RelationId((checkItem: CheckItem) => checkItem.updater)
|
|
73
|
+
updaterId?: string
|
|
74
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
+
|
|
6
|
+
import { Checklist } from './checklist'
|
|
7
|
+
import { NewChecklist, ChecklistPatch } from './checklist-type'
|
|
8
|
+
|
|
9
|
+
@Resolver(Checklist)
|
|
10
|
+
export class ChecklistMutation {
|
|
11
|
+
@Directive('@transaction')
|
|
12
|
+
@Mutation(returns => Checklist, { description: 'To create new Checklist' })
|
|
13
|
+
async createChecklist(
|
|
14
|
+
@Arg('checklist') checklist: NewChecklist,
|
|
15
|
+
@Ctx() context: ResolverContext
|
|
16
|
+
): Promise<Checklist> {
|
|
17
|
+
const { domain, user, tx } = context.state
|
|
18
|
+
|
|
19
|
+
const result = await tx.getRepository(Checklist).save({
|
|
20
|
+
...checklist,
|
|
21
|
+
domain,
|
|
22
|
+
creator: user,
|
|
23
|
+
updater: user
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Directive('@transaction')
|
|
30
|
+
@Mutation(returns => Checklist, { description: 'To modify Checklist information' })
|
|
31
|
+
async updateChecklist(
|
|
32
|
+
@Arg('id') id: string,
|
|
33
|
+
@Arg('patch') patch: ChecklistPatch,
|
|
34
|
+
@Ctx() context: ResolverContext
|
|
35
|
+
): Promise<Checklist> {
|
|
36
|
+
const { domain, user, tx } = context.state
|
|
37
|
+
|
|
38
|
+
const repository = tx.getRepository(Checklist)
|
|
39
|
+
const checklist = await repository.findOne({
|
|
40
|
+
where: { id }
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const result = await repository.save({
|
|
44
|
+
...checklist,
|
|
45
|
+
...patch,
|
|
46
|
+
updater: user
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return result
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Directive('@transaction')
|
|
53
|
+
@Mutation(returns => [Checklist], { description: "To modify multiple Checklists' information" })
|
|
54
|
+
async updateMultipleChecklist(
|
|
55
|
+
@Arg('patches', type => [ChecklistPatch]) patches: ChecklistPatch[],
|
|
56
|
+
@Ctx() context: ResolverContext
|
|
57
|
+
): Promise<Checklist[]> {
|
|
58
|
+
const { domain, user, tx } = context.state
|
|
59
|
+
|
|
60
|
+
let results = []
|
|
61
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
62
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
63
|
+
const checklistRepo = tx.getRepository(Checklist)
|
|
64
|
+
|
|
65
|
+
if (_createRecords.length > 0) {
|
|
66
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
67
|
+
const newRecord = _createRecords[i]
|
|
68
|
+
|
|
69
|
+
const result = await checklistRepo.save({
|
|
70
|
+
...newRecord,
|
|
71
|
+
domain,
|
|
72
|
+
creator: user,
|
|
73
|
+
updater: user
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
results.push({ ...result, cuFlag: '+' })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (_updateRecords.length > 0) {
|
|
81
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
82
|
+
const updateRecord = _updateRecords[i]
|
|
83
|
+
const checklist = await checklistRepo.findOneBy({ id: updateRecord.id })
|
|
84
|
+
|
|
85
|
+
const result = await checklistRepo.save({
|
|
86
|
+
...checklist,
|
|
87
|
+
...updateRecord,
|
|
88
|
+
updater: user
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return results
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Directive('@transaction')
|
|
99
|
+
@Mutation(returns => Boolean, { description: 'To delete Checklist' })
|
|
100
|
+
async deleteChecklist(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
101
|
+
const { domain, tx } = context.state
|
|
102
|
+
|
|
103
|
+
await tx.getRepository(Checklist).delete({ id })
|
|
104
|
+
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
105
|
+
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Directive('@transaction')
|
|
110
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple Checklists' })
|
|
111
|
+
async deleteChecklists(
|
|
112
|
+
@Arg('ids', type => [String]) ids: string[],
|
|
113
|
+
@Ctx() context: ResolverContext
|
|
114
|
+
): Promise<boolean> {
|
|
115
|
+
const { domain, tx } = context.state
|
|
116
|
+
|
|
117
|
+
await tx.getRepository(Checklist).delete({
|
|
118
|
+
id: In(ids)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
122
|
+
|
|
123
|
+
return true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Directive('@transaction')
|
|
127
|
+
@Mutation(returns => Boolean, { description: 'To import multiple Checklists' })
|
|
128
|
+
async importChecklists(
|
|
129
|
+
@Arg('checklists', type => [ChecklistPatch]) checklists: ChecklistPatch[],
|
|
130
|
+
@Ctx() context: ResolverContext
|
|
131
|
+
): Promise<boolean> {
|
|
132
|
+
const { domain, tx } = context.state
|
|
133
|
+
|
|
134
|
+
await Promise.all(
|
|
135
|
+
checklists.map(async (checklist: ChecklistPatch) => {
|
|
136
|
+
const createdChecklist: Checklist = await tx.getRepository(Checklist).save({ domain, ...checklist })
|
|
137
|
+
})
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
return true
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { Checklist } from './checklist'
|
|
6
|
+
import { ChecklistList } from './checklist-type'
|
|
7
|
+
|
|
8
|
+
@Resolver(Checklist)
|
|
9
|
+
export class ChecklistQuery {
|
|
10
|
+
@Query(returns => Checklist!, { nullable: true, description: 'To fetch a Checklist' })
|
|
11
|
+
async checklist(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Checklist> {
|
|
12
|
+
const { domain } = context.state
|
|
13
|
+
|
|
14
|
+
return await getRepository(Checklist).findOne({
|
|
15
|
+
where: { id }
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Query(returns => ChecklistList, { description: 'To fetch multiple Checklists' })
|
|
20
|
+
async checklists(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ChecklistList> {
|
|
21
|
+
const { domain } = context.state
|
|
22
|
+
|
|
23
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
24
|
+
domain,
|
|
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 => String)
|
|
36
|
+
async thumbnail(@Root() checklist: Checklist): Promise<string | undefined> {
|
|
37
|
+
const attachment: Attachment = await getRepository(Attachment).findOne({
|
|
38
|
+
where: {
|
|
39
|
+
refType: Checklist.name,
|
|
40
|
+
refBy: checklist.id
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return attachment?.fullpath
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@FieldResolver(type => User)
|
|
48
|
+
async updater(@Root() checklist: Checklist): Promise<User> {
|
|
49
|
+
return await getRepository(User).findOneBy({ id: checklist.updaterId })
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@FieldResolver(type => User)
|
|
53
|
+
async creator(@Root() checklist: Checklist): Promise<User> {
|
|
54
|
+
return await getRepository(User).findOneBy({ id: checklist.creatorId })
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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, registerEnumType } from 'type-graphql'
|
|
14
|
+
|
|
15
|
+
import { User } from '@things-factory/auth-base'
|
|
16
|
+
import { Task } from '../task/task'
|
|
17
|
+
import { CheckItem } from '../check-item/check-item'
|
|
18
|
+
|
|
19
|
+
@Entity()
|
|
20
|
+
@Index('ix_checklist_0', (checklist: Checklist) => [checklist.task], { where: '"deleted_at" IS NULL' })
|
|
21
|
+
@ObjectType({ description: '체크리스트' })
|
|
22
|
+
export class Checklist {
|
|
23
|
+
@PrimaryGeneratedColumn('uuid')
|
|
24
|
+
@Field(type => ID)
|
|
25
|
+
readonly id: string
|
|
26
|
+
|
|
27
|
+
@Column({ nullable: true, comment: '이름' })
|
|
28
|
+
@Field({ nullable: true })
|
|
29
|
+
name?: string
|
|
30
|
+
|
|
31
|
+
@Column({ nullable: true, comment: '문서 번호' })
|
|
32
|
+
@Field({ nullable: true })
|
|
33
|
+
documentNo?: string
|
|
34
|
+
|
|
35
|
+
@Column({ nullable: true, comment: '부위' })
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
part?: string
|
|
38
|
+
|
|
39
|
+
@Column({ nullable: true, comment: '위치' })
|
|
40
|
+
@Field({ nullable: true })
|
|
41
|
+
location?: string
|
|
42
|
+
|
|
43
|
+
@Column({ nullable: true, comment: '시공자 점검일' })
|
|
44
|
+
@Field({ nullable: true })
|
|
45
|
+
constructionInspectorDate?: Date
|
|
46
|
+
|
|
47
|
+
@Column({ nullable: true, comment: '감리자 점검일' })
|
|
48
|
+
@Field({ nullable: true })
|
|
49
|
+
supervisorInspectorDate?: Date
|
|
50
|
+
|
|
51
|
+
@Column({ nullable: true, comment: '총괄 시공 책임자 사인' })
|
|
52
|
+
@Field({ nullable: true })
|
|
53
|
+
overallConstructionSignature?: string
|
|
54
|
+
|
|
55
|
+
@Column({ nullable: true, comment: '공종별 시공 관리자 사인' })
|
|
56
|
+
@Field({ nullable: true })
|
|
57
|
+
taskConstructionSignature?: string
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true, comment: '총괄 감리 책임자 사인' })
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
overallSupervisorySignature?: string
|
|
62
|
+
|
|
63
|
+
@Column({ nullable: true, comment: '건축사보 (공종별 감리 관리자) 사인' })
|
|
64
|
+
@Field({ nullable: true })
|
|
65
|
+
taskSupervisorySignature?: string
|
|
66
|
+
|
|
67
|
+
// 공정표 작업 정보 (상위 테이블 참조)
|
|
68
|
+
@Field(() => Task)
|
|
69
|
+
@ManyToOne(() => Task, task => task.checklists)
|
|
70
|
+
task?: Task
|
|
71
|
+
|
|
72
|
+
@RelationId((checklist: Checklist) => checklist.task)
|
|
73
|
+
taskId?: string
|
|
74
|
+
|
|
75
|
+
// 체크리스트 아이템 정보 (하위 테이블 참조)
|
|
76
|
+
@Field(() => CheckItem)
|
|
77
|
+
@OneToMany(() => CheckItem, checkItem => checkItem.checklist)
|
|
78
|
+
checkItems?: CheckItem[]
|
|
79
|
+
|
|
80
|
+
@CreateDateColumn()
|
|
81
|
+
@Field({ nullable: true })
|
|
82
|
+
createdAt?: Date
|
|
83
|
+
|
|
84
|
+
@UpdateDateColumn()
|
|
85
|
+
@Field({ nullable: true })
|
|
86
|
+
updatedAt?: Date
|
|
87
|
+
|
|
88
|
+
@DeleteDateColumn()
|
|
89
|
+
@Field({ nullable: true })
|
|
90
|
+
deletedAt?: Date
|
|
91
|
+
|
|
92
|
+
@ManyToOne(type => User, { nullable: true })
|
|
93
|
+
@Field(type => User, { nullable: true })
|
|
94
|
+
creator?: User
|
|
95
|
+
|
|
96
|
+
@RelationId((checklist: Checklist) => checklist.creator)
|
|
97
|
+
creatorId?: string
|
|
98
|
+
|
|
99
|
+
@ManyToOne(type => User, { nullable: true })
|
|
100
|
+
@Field(type => User, { nullable: true })
|
|
101
|
+
updater?: User
|
|
102
|
+
|
|
103
|
+
@RelationId((checklist: Checklist) => checklist.updater)
|
|
104
|
+
updaterId?: string
|
|
105
|
+
}
|