@things-factory/dataset 5.0.0-alpha.19 → 5.0.0-alpha.21
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/README.md +13 -0
- package/assets/data-samples.jpg +0 -0
- package/client/pages/data-item-list.js +3 -1
- package/client/pages/data-ooc-view.js +90 -42
- package/client/pages/data-ooc.js +78 -77
- package/client/pages/data-sample-view.js +2 -1
- package/client/pages/data-sensor.js +2 -0
- package/client/pages/data-set.js +78 -51
- package/dist-server/controllers/create-data-sample.js +21 -3
- package/dist-server/controllers/create-data-sample.js.map +1 -1
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-mutation.js +32 -70
- package/dist-server/service/data-ooc/data-ooc-mutation.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc.js +9 -7
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -1
- package/package.json +14 -14
- package/server/controllers/create-data-sample.ts +22 -4
- package/server/routes.ts +1 -1
- package/server/service/data-ooc/data-ooc-mutation.ts +106 -73
- package/server/service/data-ooc/data-ooc.ts +5 -4
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
@@ -11,9 +11,23 @@ export class DataOocMutation {
|
|
11
11
|
async createDataOoc(@Arg('dataOoc') dataOoc: NewDataOoc, @Ctx() context: any): Promise<DataOoc> {
|
12
12
|
const { domain, user, tx } = context.state
|
13
13
|
|
14
|
+
const state = dataOoc.state || DataOocStatus.CREATED
|
15
|
+
const history = [
|
16
|
+
{
|
17
|
+
user: {
|
18
|
+
id: user.id,
|
19
|
+
name: user.name
|
20
|
+
},
|
21
|
+
state,
|
22
|
+
timestamp: Date.now()
|
23
|
+
}
|
24
|
+
]
|
25
|
+
|
14
26
|
return await tx.getRepository(DataOoc).save({
|
15
27
|
...dataOoc,
|
28
|
+
state,
|
16
29
|
domain,
|
30
|
+
history,
|
17
31
|
creator: user,
|
18
32
|
updater: user
|
19
33
|
})
|
@@ -30,88 +44,107 @@ export class DataOocMutation {
|
|
30
44
|
where: { domain, id }
|
31
45
|
})
|
32
46
|
|
47
|
+
const state = patch.state || dataOoc.state
|
48
|
+
|
49
|
+
const history = dataOoc.history || []
|
50
|
+
history.push({
|
51
|
+
user: {
|
52
|
+
id: user.id,
|
53
|
+
name: user.name
|
54
|
+
},
|
55
|
+
state,
|
56
|
+
comment: patch.correctiveAction || '',
|
57
|
+
timestamp: Date.now()
|
58
|
+
})
|
59
|
+
|
33
60
|
const more = {} as any
|
34
|
-
|
35
|
-
|
36
|
-
|
61
|
+
|
62
|
+
if (dataOoc.state !== patch.state) {
|
63
|
+
if (patch.state === DataOocStatus.CORRECTED) {
|
64
|
+
more.corrector = user
|
65
|
+
} else {
|
66
|
+
more.corrector = null
|
67
|
+
}
|
37
68
|
}
|
38
69
|
|
39
70
|
return await repository.save({
|
40
71
|
...dataOoc,
|
41
72
|
...patch,
|
42
73
|
...more,
|
74
|
+
state,
|
75
|
+
history,
|
43
76
|
updater: user
|
44
77
|
})
|
45
78
|
}
|
46
79
|
|
47
|
-
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
48
|
-
@Directive('@transaction')
|
49
|
-
@Mutation(returns => [DataOoc], { description: "To modify multiple DataOoc' information" })
|
50
|
-
async updateMultipleDataOoc(
|
51
|
-
|
52
|
-
|
53
|
-
): Promise<DataOoc[]> {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
}
|
93
|
-
|
94
|
-
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
95
|
-
@Directive('@transaction')
|
96
|
-
@Mutation(returns => Boolean, { description: 'To delete DataOoc' })
|
97
|
-
async deleteDataOoc(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
}
|
103
|
-
|
104
|
-
@Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
105
|
-
@Directive('@transaction')
|
106
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple dataOocs' })
|
107
|
-
async deleteDataOocs(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
}
|
80
|
+
// @Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
81
|
+
// @Directive('@transaction')
|
82
|
+
// @Mutation(returns => [DataOoc], { description: "To modify multiple DataOoc' information" })
|
83
|
+
// async updateMultipleDataOoc(
|
84
|
+
// @Arg('patches', type => [DataOocPatch]) patches: DataOocPatch[],
|
85
|
+
// @Ctx() context: any
|
86
|
+
// ): Promise<DataOoc[]> {
|
87
|
+
// const { domain, user, tx } = context.state
|
88
|
+
|
89
|
+
// let results = []
|
90
|
+
// const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
91
|
+
// const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
92
|
+
// const dataOocRepo = tx.getRepository(DataOoc)
|
93
|
+
|
94
|
+
// if (_createRecords.length > 0) {
|
95
|
+
// for (let i = 0; i < _createRecords.length; i++) {
|
96
|
+
// const newRecord = _createRecords[i]
|
97
|
+
|
98
|
+
// const result = await dataOocRepo.save({
|
99
|
+
// ...newRecord,
|
100
|
+
// domain,
|
101
|
+
// creator: user,
|
102
|
+
// updater: user
|
103
|
+
// })
|
104
|
+
|
105
|
+
// results.push({ ...result, cuFlag: '+' })
|
106
|
+
// }
|
107
|
+
// }
|
108
|
+
|
109
|
+
// if (_updateRecords.length > 0) {
|
110
|
+
// for (let i = 0; i < _updateRecords.length; i++) {
|
111
|
+
// const newRecord = _updateRecords[i]
|
112
|
+
// const dataOoc = await dataOocRepo.findOne(newRecord.id)
|
113
|
+
|
114
|
+
// const result = await dataOocRepo.save({
|
115
|
+
// ...dataOoc,
|
116
|
+
// ...newRecord,
|
117
|
+
// updater: user
|
118
|
+
// })
|
119
|
+
|
120
|
+
// results.push({ ...result, cuFlag: 'M' })
|
121
|
+
// }
|
122
|
+
// }
|
123
|
+
|
124
|
+
// return results
|
125
|
+
// }
|
126
|
+
|
127
|
+
// @Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
128
|
+
// @Directive('@transaction')
|
129
|
+
// @Mutation(returns => Boolean, { description: 'To delete DataOoc' })
|
130
|
+
// async deleteDataOoc(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
131
|
+
// const { domain, tx } = context.state
|
132
|
+
|
133
|
+
// await tx.getRepository(DataOoc).delete({ domain, id })
|
134
|
+
// return true
|
135
|
+
// }
|
136
|
+
|
137
|
+
// @Directive('@privilege(category: "data-ooc", privilege: "mutation", domainOwnerGranted: true)')
|
138
|
+
// @Directive('@transaction')
|
139
|
+
// @Mutation(returns => Boolean, { description: 'To delete multiple dataOocs' })
|
140
|
+
// async deleteDataOocs(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
141
|
+
// const { domain, tx } = context.state
|
142
|
+
|
143
|
+
// await tx.getRepository(DataOoc).delete({
|
144
|
+
// domain,
|
145
|
+
// id: In(ids)
|
146
|
+
// })
|
147
|
+
|
148
|
+
// return true
|
149
|
+
// }
|
117
150
|
}
|
@@ -24,10 +24,7 @@ const DATABASE_TYPE = ORMCONFIG.type
|
|
24
24
|
export enum DataOocStatus {
|
25
25
|
CREATED = 'CREATED',
|
26
26
|
REVIEWED = 'REVIEWED',
|
27
|
-
CORRECTED = 'CORRECTED'
|
28
|
-
SUBMITTED = 'SUBMITTED',
|
29
|
-
APPROVED = 'APPROVED',
|
30
|
-
REJECTED = 'REJECTED'
|
27
|
+
CORRECTED = 'CORRECTED'
|
31
28
|
}
|
32
29
|
|
33
30
|
registerEnumType(DataOocStatus, {
|
@@ -131,6 +128,10 @@ export class DataOoc {
|
|
131
128
|
@Field(type => ScalarObject, { nullable: true })
|
132
129
|
spec?: ScalarObject
|
133
130
|
|
131
|
+
@Column('simple-json', { nullable: true })
|
132
|
+
@Field(type => ScalarObject, { nullable: true })
|
133
|
+
history?: ScalarObject
|
134
|
+
|
134
135
|
@Column({
|
135
136
|
nullable: true,
|
136
137
|
type:
|
package/translations/en.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "corrected",
|
3
|
+
"button.reviewed": "reviewed",
|
2
4
|
"field.appliance": "appliance",
|
3
5
|
"field.collected_at": "collected at",
|
4
6
|
"field.corrective-action": "corrective action",
|
@@ -24,6 +26,7 @@
|
|
24
26
|
"field.unit": "unit",
|
25
27
|
"field.use-case": "use case",
|
26
28
|
"text.data sample created successfully": "a data sample created successfully",
|
29
|
+
"text.data ooc updated successfully": "a data ooc updated successfully",
|
27
30
|
"title.data-entry-form": "data entry form",
|
28
31
|
"title.data-item list": "data item list",
|
29
32
|
"title.data-ooc list": "data OOC list",
|
package/translations/ko.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "조치완료",
|
3
|
+
"button.reviewed": "검토완료",
|
2
4
|
"field.appliance": "어플라이언스",
|
3
5
|
"field.collected_at": "수집일시",
|
4
6
|
"field.corrective-action": "조치 활동",
|
@@ -24,6 +26,7 @@
|
|
24
26
|
"field.unit": "단위",
|
25
27
|
"field.use-case": "사용 사례",
|
26
28
|
"text.data sample created successfully": "데이타 샘플이 성공적으로 생성되었습니다",
|
29
|
+
"text.data ooc updated successfully": "이탈데이타 내용이 수정되었습니다",
|
27
30
|
"title.data-entry-form": "데이타 입력",
|
28
31
|
"title.data-item list": "데이타 아이템 조회",
|
29
32
|
"title.data-ooc list": "데이타 이탈점 조회",
|
package/translations/ms.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "corrected",
|
3
|
+
"button.reviewed": "reviewed",
|
2
4
|
"field.appliance": "appliance",
|
3
5
|
"field.collected_at": "collected at",
|
4
6
|
"field.corrective-action": "corrective action",
|
@@ -24,6 +26,7 @@
|
|
24
26
|
"field.unit": "unit",
|
25
27
|
"field.use-case": "use case",
|
26
28
|
"text.data sample created successfully": "a data sample created successfully",
|
29
|
+
"text.data ooc updated successfully": "a data ooc updated successfully",
|
27
30
|
"title.data-entry-form": "data entry form",
|
28
31
|
"title.data-item list": "data item list",
|
29
32
|
"title.data-ooc list": "data OOC list",
|
package/translations/zh.json
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "corrected",
|
3
|
+
"button.reviewed": "reviewed",
|
2
4
|
"field.appliance": "appliance",
|
3
5
|
"field.collected_at": "collected at",
|
4
6
|
"field.corrective-action": "corrective action",
|
@@ -24,6 +26,7 @@
|
|
24
26
|
"field.unit": "unit",
|
25
27
|
"field.use-case": "use case",
|
26
28
|
"text.data sample created successfully": "a data sample created successfully",
|
29
|
+
"text.data ooc updated successfully": "a data ooc updated successfully",
|
27
30
|
"title.data-entry-form": "data entry form",
|
28
31
|
"title.data-item list": "data item list",
|
29
32
|
"title.data-ooc list": "data OOC list",
|