@things-factory/dataset 5.0.0-alpha.2 → 5.0.0-alpha.20
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 +12 -0
- package/assets/data-samples.jpg +0 -0
- package/client/bootstrap.js +16 -1
- package/client/pages/data-entry-form.js +84 -0
- package/client/pages/data-item-list.js +58 -16
- package/client/pages/data-ooc-view.js +182 -0
- package/client/pages/data-ooc.js +469 -0
- package/client/pages/data-sample-view.js +97 -0
- package/client/pages/data-sample.js +130 -55
- package/client/pages/data-sensor.js +8 -18
- package/client/pages/data-set.js +126 -25
- package/client/route.js +4 -0
- package/dist-server/controllers/create-data-sample.js +122 -0
- package/dist-server/controllers/create-data-sample.js.map +1 -0
- package/dist-server/controllers/data-use-case.js +57 -0
- package/dist-server/controllers/data-use-case.js.map +1 -0
- package/dist-server/controllers/index.js +17 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/index.js +2 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +9 -24
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/data-item/data-item-mutation.js +5 -1
- package/dist-server/service/data-item/data-item-mutation.js.map +1 -1
- package/dist-server/service/data-item/data-item-type.js +14 -5
- package/dist-server/service/data-item/data-item-type.js.map +1 -1
- package/dist-server/service/data-item/data-item.js +20 -7
- package/dist-server/service/data-item/data-item.js.map +1 -1
- package/dist-server/service/data-ooc/data-ooc-mutation.js +92 -0
- package/dist-server/service/data-ooc/data-ooc-mutation.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc-query.js +115 -0
- package/dist-server/service/data-ooc/data-ooc-query.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc-subscription.js +65 -0
- package/dist-server/service/data-ooc/data-ooc-subscription.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc-type.js +99 -0
- package/dist-server/service/data-ooc/data-ooc-type.js.map +1 -0
- package/dist-server/service/data-ooc/data-ooc.js +227 -0
- package/dist-server/service/data-ooc/data-ooc.js.map +1 -0
- package/dist-server/service/data-ooc/index.js +10 -0
- package/dist-server/service/data-ooc/index.js.map +1 -0
- package/dist-server/service/data-sample/data-sample-mutation.js +3 -105
- package/dist-server/service/data-sample/data-sample-mutation.js.map +1 -1
- package/dist-server/service/data-sample/data-sample-type.js +6 -43
- package/dist-server/service/data-sample/data-sample-type.js.map +1 -1
- package/dist-server/service/data-sample/data-sample.js +33 -12
- package/dist-server/service/data-sample/data-sample.js.map +1 -1
- package/dist-server/service/data-set/data-set-mutation.js +1 -2
- package/dist-server/service/data-set/data-set-mutation.js.map +1 -1
- package/dist-server/service/data-set/data-set-query.js +12 -0
- package/dist-server/service/data-set/data-set-query.js.map +1 -1
- package/dist-server/service/data-set/data-set-type.js +19 -2
- package/dist-server/service/data-set/data-set-type.js.map +1 -1
- package/dist-server/service/data-set/data-set.js +22 -10
- package/dist-server/service/data-set/data-set.js.map +1 -1
- package/dist-server/service/data-spec/data-spec-manager.js +20 -0
- package/dist-server/service/data-spec/data-spec-manager.js.map +1 -0
- package/dist-server/service/data-spec/data-spec-query.js +48 -0
- package/dist-server/service/data-spec/data-spec-query.js.map +1 -0
- package/dist-server/service/data-spec/data-spec.js +78 -0
- package/dist-server/service/data-spec/data-spec.js.map +1 -0
- package/dist-server/service/data-spec/index.js +8 -0
- package/dist-server/service/data-spec/index.js.map +1 -0
- package/dist-server/service/index.js +12 -4
- package/dist-server/service/index.js.map +1 -1
- package/package.json +15 -12
- package/server/controllers/create-data-sample.ts +161 -0
- package/server/controllers/data-use-case.ts +85 -0
- package/server/controllers/index.ts +1 -0
- package/server/index.ts +3 -0
- package/server/routes.ts +18 -32
- package/server/service/data-item/data-item-mutation.ts +6 -1
- package/server/service/data-item/data-item-type.ts +11 -7
- package/server/service/data-item/data-item.ts +16 -6
- package/server/service/data-ooc/data-ooc-mutation.ts +150 -0
- package/server/service/data-ooc/data-ooc-query.ts +63 -0
- package/server/service/data-ooc/data-ooc-subscription.ts +51 -0
- package/server/service/data-ooc/data-ooc-type.ts +62 -0
- package/server/service/data-ooc/data-ooc.ts +195 -0
- package/server/service/data-ooc/index.ts +7 -0
- package/server/service/data-sample/data-sample-mutation.ts +6 -128
- package/server/service/data-sample/data-sample-type.ts +4 -32
- package/server/service/data-sample/data-sample.ts +31 -10
- package/server/service/data-set/data-set-mutation.ts +1 -4
- package/server/service/data-set/data-set-query.ts +8 -1
- package/server/service/data-set/data-set-type.ts +17 -6
- package/server/service/data-set/data-set.ts +18 -8
- package/server/service/data-spec/data-spec-manager.ts +21 -0
- package/server/service/data-spec/data-spec-query.ts +21 -0
- package/server/service/data-spec/data-spec.ts +44 -0
- package/server/service/data-spec/index.ts +5 -0
- package/server/service/index.ts +16 -8
- package/things-factory.config.js +4 -0
- package/translations/en.json +20 -1
- package/translations/ko.json +21 -2
- package/translations/ms.json +20 -1
- package/translations/zh.json +20 -1
@@ -1,10 +1,11 @@
|
|
1
1
|
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
2
|
-
import { In } from 'typeorm'
|
3
2
|
|
4
|
-
import { DataItem } from '../data-item/data-item'
|
5
|
-
import { DataSet } from '../data-set/data-set'
|
6
3
|
import { DataSample } from './data-sample'
|
7
|
-
import {
|
4
|
+
import { NewDataSample } from './data-sample-type'
|
5
|
+
|
6
|
+
import { createDataSample } from '../../controllers/create-data-sample'
|
7
|
+
|
8
|
+
const debug = require('debug')('things-factory:dataset:data-sample:data-sample-mutation')
|
8
9
|
|
9
10
|
@Resolver(DataSample)
|
10
11
|
export class DataSampleMutation {
|
@@ -12,129 +13,6 @@ export class DataSampleMutation {
|
|
12
13
|
@Directive('@transaction')
|
13
14
|
@Mutation(returns => DataSample, { description: 'To create new data sample' })
|
14
15
|
async createDataSample(@Arg('dataSample') dataSample: NewDataSample, @Ctx() context: any): Promise<DataSample> {
|
15
|
-
|
16
|
-
|
17
|
-
const dataSet = await tx.getRepository(DataSet).findOne({ id: dataSample.dataSetId })
|
18
|
-
const dataItems = await tx.getRepository(DataItem).find({
|
19
|
-
where: {
|
20
|
-
domain,
|
21
|
-
dataSet
|
22
|
-
},
|
23
|
-
order: {
|
24
|
-
sequence: 'DESC'
|
25
|
-
}
|
26
|
-
})
|
27
|
-
|
28
|
-
var spec = {} as any
|
29
|
-
|
30
|
-
dataItems.forEach(dataItem => {
|
31
|
-
spec[dataItem.name] = dataItem.spec
|
32
|
-
// TODO 변수형 스펙값은 처리 결과값을 spec의 아이템 value로 반영하여야 한다.
|
33
|
-
})
|
34
|
-
|
35
|
-
return await tx.getRepository(DataSample).save({
|
36
|
-
name: dataSet.name,
|
37
|
-
description: dataSet.description,
|
38
|
-
collectedAt: new Date(),
|
39
|
-
...dataSample,
|
40
|
-
domain,
|
41
|
-
partitionKeys: dataSet.partitionKeys,
|
42
|
-
spec,
|
43
|
-
creator: user,
|
44
|
-
updater: user
|
45
|
-
})
|
46
|
-
}
|
47
|
-
|
48
|
-
@Directive('@privilege(category: "data-sample", privilege: "mutation", domainOwnerGranted: true)')
|
49
|
-
@Directive('@transaction')
|
50
|
-
@Mutation(returns => DataSample, { description: 'To modify data sample information' })
|
51
|
-
async updateDataSample(
|
52
|
-
@Arg('id') id: string,
|
53
|
-
@Arg('patch') patch: DataSamplePatch,
|
54
|
-
@Ctx() context: any
|
55
|
-
): Promise<DataSample> {
|
56
|
-
const { domain, user, tx } = context.state
|
57
|
-
|
58
|
-
const repository = tx.getRepository(DataSample)
|
59
|
-
const dataSample = await repository.findOne({
|
60
|
-
where: { domain, id }
|
61
|
-
})
|
62
|
-
|
63
|
-
return await repository.save({
|
64
|
-
...dataSample,
|
65
|
-
...patch,
|
66
|
-
updater: user
|
67
|
-
})
|
68
|
-
}
|
69
|
-
|
70
|
-
@Directive('@privilege(category: "data-sample", privilege: "mutation", domainOwnerGranted: true)')
|
71
|
-
@Directive('@transaction')
|
72
|
-
@Mutation(returns => [DataSample], { description: "To modify multiple data samples' information" })
|
73
|
-
async updateMultipleDataSample(
|
74
|
-
@Arg('patches', type => [DataSamplePatch]) patches: DataSamplePatch[],
|
75
|
-
@Ctx() context: any
|
76
|
-
): Promise<DataSample[]> {
|
77
|
-
const { domain, user, tx } = context.state
|
78
|
-
|
79
|
-
let results = []
|
80
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
81
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
82
|
-
const dataSampleRepo = tx.getRepository(DataSample)
|
83
|
-
|
84
|
-
if (_createRecords.length > 0) {
|
85
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
86
|
-
const newRecord = _createRecords[i]
|
87
|
-
|
88
|
-
const result = await dataSampleRepo.save({
|
89
|
-
...newRecord,
|
90
|
-
domain,
|
91
|
-
creator: user,
|
92
|
-
updater: user
|
93
|
-
})
|
94
|
-
|
95
|
-
results.push({ ...result, cuFlag: '+' })
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
if (_updateRecords.length > 0) {
|
100
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
101
|
-
const newRecord = _updateRecords[i]
|
102
|
-
const dataSample = await dataSampleRepo.findOne(newRecord.id)
|
103
|
-
|
104
|
-
const result = await dataSampleRepo.save({
|
105
|
-
...dataSample,
|
106
|
-
...newRecord,
|
107
|
-
updater: user
|
108
|
-
})
|
109
|
-
|
110
|
-
results.push({ ...result, cuFlag: 'M' })
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
|
-
return results
|
115
|
-
}
|
116
|
-
|
117
|
-
@Directive('@privilege(category: "data-sample", privilege: "mutation", domainOwnerGranted: true)')
|
118
|
-
@Directive('@transaction')
|
119
|
-
@Mutation(returns => Boolean, { description: 'To delete a data sample' })
|
120
|
-
async deleteDataSample(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
121
|
-
const { domain, tx } = context.state
|
122
|
-
|
123
|
-
await tx.getRepository(DataSample).delete({ domain, id })
|
124
|
-
return true
|
125
|
-
}
|
126
|
-
|
127
|
-
@Directive('@privilege(category: "data-sample", privilege: "mutation", domainOwnerGranted: true)')
|
128
|
-
@Directive('@transaction')
|
129
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple data samples' })
|
130
|
-
async deleteDataSamples(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
131
|
-
const { domain, tx } = context.state
|
132
|
-
|
133
|
-
await tx.getRepository(DataSample).delete({
|
134
|
-
domain,
|
135
|
-
id: In(ids)
|
136
|
-
})
|
137
|
-
|
138
|
-
return true
|
16
|
+
return await createDataSample(dataSample, context)
|
139
17
|
}
|
140
18
|
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
|
2
|
-
|
3
|
-
import { ScalarObject } from '@things-factory/shell'
|
2
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
4
3
|
|
5
4
|
import { DataSample } from './data-sample'
|
6
5
|
|
@@ -12,11 +11,11 @@ export class NewDataSample {
|
|
12
11
|
@Field({ nullable: true })
|
13
12
|
description?: string
|
14
13
|
|
15
|
-
@Field({ nullable: true })
|
16
|
-
|
14
|
+
@Field(type => ObjectRef, { nullable: true })
|
15
|
+
dataSet?: ObjectRef
|
17
16
|
|
18
17
|
@Field(type => ScalarObject, { nullable: true })
|
19
|
-
data?:
|
18
|
+
data?: ScalarObject
|
20
19
|
|
21
20
|
@Field({ nullable: true })
|
22
21
|
rawData?: string
|
@@ -28,33 +27,6 @@ export class NewDataSample {
|
|
28
27
|
collectedAt?: Date
|
29
28
|
}
|
30
29
|
|
31
|
-
@InputType()
|
32
|
-
export class DataSamplePatch {
|
33
|
-
@Field(type => ID, { nullable: true })
|
34
|
-
id?: string
|
35
|
-
|
36
|
-
@Field({ nullable: true })
|
37
|
-
name?: string
|
38
|
-
|
39
|
-
@Field({ nullable: true })
|
40
|
-
description?: string
|
41
|
-
|
42
|
-
@Field({ nullable: true })
|
43
|
-
dataSetId?: string
|
44
|
-
|
45
|
-
@Field(type => ScalarObject, { nullable: true })
|
46
|
-
data?: object
|
47
|
-
|
48
|
-
@Field({ nullable: true })
|
49
|
-
rawData?: string
|
50
|
-
|
51
|
-
@Field({ nullable: true })
|
52
|
-
source?: string
|
53
|
-
|
54
|
-
@Field()
|
55
|
-
cuFlag: string
|
56
|
-
}
|
57
|
-
|
58
30
|
@ObjectType()
|
59
31
|
export class DataSampleList {
|
60
32
|
@Field(type => [DataSample])
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Field, ID, ObjectType } from 'type-graphql'
|
2
1
|
import {
|
3
2
|
Column,
|
4
3
|
CreateDateColumn,
|
@@ -9,17 +8,22 @@ import {
|
|
9
8
|
RelationId,
|
10
9
|
UpdateDateColumn
|
11
10
|
} from 'typeorm'
|
12
|
-
|
13
|
-
import { User } from '@things-factory/auth-base'
|
14
|
-
import { config } from '@things-factory/env'
|
15
11
|
import { Domain, ScalarObject } from '@things-factory/shell'
|
12
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
16
13
|
|
17
14
|
import { DataSet } from '../data-set/data-set'
|
15
|
+
import { User } from '@things-factory/auth-base'
|
16
|
+
import { config } from '@things-factory/env'
|
18
17
|
|
19
18
|
const ORMCONFIG = config.get('ormconfig', {})
|
20
19
|
const DATABASE_TYPE = ORMCONFIG.type
|
21
20
|
@Entity()
|
22
21
|
@Index('ix_data_sample_0', (dataSample: DataSample) => [dataSample.domain, dataSample.dataSet], { unique: false })
|
22
|
+
@Index(
|
23
|
+
'ix_data_sample_2',
|
24
|
+
(dataSample: DataSample) => [dataSample.domain, dataSample.dataSet, dataSample.collectedAt],
|
25
|
+
{ unique: false }
|
26
|
+
)
|
23
27
|
@ObjectType({ description: 'Entity for DataSample' })
|
24
28
|
export class DataSample {
|
25
29
|
@PrimaryGeneratedColumn('uuid')
|
@@ -49,25 +53,30 @@ export class DataSample {
|
|
49
53
|
@Field({ nullable: true })
|
50
54
|
type?: string
|
51
55
|
|
56
|
+
@Column({
|
57
|
+
nullable: true
|
58
|
+
})
|
59
|
+
@Field({ nullable: true })
|
60
|
+
useCase?: string
|
61
|
+
|
52
62
|
@Column('simple-json', { nullable: true })
|
53
63
|
@Field(type => ScalarObject, { nullable: true })
|
54
|
-
partitionKeys?:
|
64
|
+
partitionKeys?: ScalarObject
|
55
65
|
|
56
|
-
@ManyToOne(type => DataSet
|
57
|
-
@Field(type => DataSet, { nullable:
|
66
|
+
@ManyToOne(type => DataSet)
|
67
|
+
@Field(type => DataSet, { nullable: false })
|
58
68
|
dataSet?: DataSet
|
59
69
|
|
60
70
|
@RelationId((dataSample: DataSample) => dataSample.dataSet)
|
61
|
-
@Field({ nullable: true })
|
62
71
|
dataSetId?: string
|
63
72
|
|
64
73
|
@Column('simple-json', { nullable: true })
|
65
74
|
@Field(type => ScalarObject, { nullable: true })
|
66
|
-
data?:
|
75
|
+
data?: ScalarObject
|
67
76
|
|
68
77
|
@Column('simple-json', { nullable: true })
|
69
78
|
@Field(type => ScalarObject, { nullable: true })
|
70
|
-
spec?:
|
79
|
+
spec?: ScalarObject
|
71
80
|
|
72
81
|
@Column({
|
73
82
|
nullable: true,
|
@@ -87,6 +96,18 @@ export class DataSample {
|
|
87
96
|
@Field({ nullable: true })
|
88
97
|
source?: string
|
89
98
|
|
99
|
+
@Column({
|
100
|
+
nullable: true
|
101
|
+
})
|
102
|
+
@Field({ nullable: true })
|
103
|
+
ooc?: boolean
|
104
|
+
|
105
|
+
@Column({
|
106
|
+
nullable: true
|
107
|
+
})
|
108
|
+
@Field({ nullable: true })
|
109
|
+
oos?: boolean
|
110
|
+
|
90
111
|
@Column({ nullable: true })
|
91
112
|
@Field({ nullable: true })
|
92
113
|
collectedAt?: Date
|
@@ -200,10 +200,7 @@ export class DataSetMutation {
|
|
200
200
|
|
201
201
|
return copiedDataSets.map(dataSet => {
|
202
202
|
dataSet.dataItems = copiedDataItems.filter(dataItem => dataItem.dataSet == dataSet.id)
|
203
|
-
return
|
204
|
-
...dataSet,
|
205
|
-
state: 'UNLOADED' // DataSetInstanceStatus.UNLOADED
|
206
|
-
}
|
203
|
+
return dataSet
|
207
204
|
})
|
208
205
|
}
|
209
206
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
2
2
|
import { getRepository } from 'typeorm'
|
3
3
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
4
|
+
import { Role, User } from '@things-factory/auth-base'
|
5
5
|
import { convertListParams, Domain, ListParam } from '@things-factory/shell'
|
6
6
|
|
7
7
|
import { DataItem } from '../data-item/data-item'
|
@@ -38,6 +38,13 @@ export class DataSetQuery {
|
|
38
38
|
})
|
39
39
|
}
|
40
40
|
|
41
|
+
@FieldResolver(type => Role)
|
42
|
+
async supervisoryRole(@Root() dataSet: DataSet): Promise<Role> {
|
43
|
+
return await getRepository(Role).findOne({
|
44
|
+
id: dataSet.supervisoryRoleId
|
45
|
+
})
|
46
|
+
}
|
47
|
+
|
41
48
|
@FieldResolver(type => Domain)
|
42
49
|
async domain(@Root() dataSet: DataSet): Promise<Domain> {
|
43
50
|
return await getRepository(Domain).findOne(dataSet.domainId)
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
|
2
|
-
|
3
|
-
import { ScalarObject } from '@things-factory/shell'
|
2
|
+
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
4
3
|
|
5
4
|
import { DataSet } from './data-set'
|
6
5
|
|
@@ -12,14 +11,20 @@ export class NewDataSet {
|
|
12
11
|
@Field({ nullable: true })
|
13
12
|
description?: string
|
14
13
|
|
14
|
+
@Field(type => ObjectRef, { nullable: true })
|
15
|
+
supervisoryRole?: ObjectRef
|
16
|
+
|
15
17
|
@Field({ nullable: true })
|
16
18
|
active?: boolean
|
17
19
|
|
18
20
|
@Field({ nullable: true })
|
19
|
-
type?: string
|
21
|
+
type?: 'manual' | 'automatic' | string
|
22
|
+
|
23
|
+
@Field({ nullable: true })
|
24
|
+
useCase?: string
|
20
25
|
|
21
26
|
@Field(type => ScalarObject, { nullable: true })
|
22
|
-
partitionKeys?:
|
27
|
+
partitionKeys?: ScalarObject
|
23
28
|
|
24
29
|
@Field({ nullable: true })
|
25
30
|
schedule?: string
|
@@ -39,14 +44,20 @@ export class DataSetPatch {
|
|
39
44
|
@Field({ nullable: true })
|
40
45
|
description?: string
|
41
46
|
|
47
|
+
@Field(type => ObjectRef, { nullable: true })
|
48
|
+
supervisoryRole?: ObjectRef
|
49
|
+
|
42
50
|
@Field({ nullable: true })
|
43
51
|
active?: boolean
|
44
52
|
|
45
53
|
@Field({ nullable: true })
|
46
|
-
type?: string
|
54
|
+
type?: 'manual' | 'automatic' | string
|
55
|
+
|
56
|
+
@Field({ nullable: true })
|
57
|
+
useCase?: string
|
47
58
|
|
48
59
|
@Field(type => ScalarObject, { nullable: true })
|
49
|
-
partitionKeys?:
|
60
|
+
partitionKeys?: ScalarObject
|
50
61
|
|
51
62
|
@Field({ nullable: true })
|
52
63
|
schedule?: string
|
@@ -11,11 +11,10 @@ import {
|
|
11
11
|
UpdateDateColumn
|
12
12
|
} from 'typeorm'
|
13
13
|
|
14
|
-
import { User } from '@things-factory/auth-base'
|
14
|
+
import { Role, User } from '@things-factory/auth-base'
|
15
15
|
import { Domain, ScalarObject } from '@things-factory/shell'
|
16
16
|
|
17
17
|
import { DataItem } from '../data-item/data-item'
|
18
|
-
import { DataSample } from '../data-sample/data-sample'
|
19
18
|
|
20
19
|
@Entity()
|
21
20
|
@Index('ix_data_set_0', (dataSet: DataSet) => [dataSet.domain, dataSet.name], { unique: true })
|
@@ -48,15 +47,30 @@ export class DataSet {
|
|
48
47
|
@Field({ nullable: true })
|
49
48
|
active?: boolean
|
50
49
|
|
50
|
+
@ManyToOne(type => Role, {
|
51
|
+
nullable: true
|
52
|
+
})
|
53
|
+
@Field(type => Role, { nullable: true })
|
54
|
+
supervisoryRole?: Role
|
55
|
+
|
56
|
+
@RelationId((dataSet: DataSet) => dataSet.supervisoryRole)
|
57
|
+
supervisoryRoleId?: string
|
58
|
+
|
59
|
+
@Column({
|
60
|
+
nullable: true
|
61
|
+
})
|
62
|
+
@Field({ nullable: true })
|
63
|
+
type?: 'manual' | 'automatic' | string
|
64
|
+
|
51
65
|
@Column({
|
52
66
|
nullable: true
|
53
67
|
})
|
54
68
|
@Field({ nullable: true })
|
55
|
-
|
69
|
+
useCase?: string
|
56
70
|
|
57
71
|
@Column('simple-json', { nullable: true })
|
58
72
|
@Field(type => ScalarObject, { nullable: true })
|
59
|
-
partitionKeys?:
|
73
|
+
partitionKeys?: ScalarObject
|
60
74
|
|
61
75
|
@Column({
|
62
76
|
nullable: true
|
@@ -68,10 +82,6 @@ export class DataSet {
|
|
68
82
|
@Field(type => [DataItem], { nullable: true })
|
69
83
|
dataItems: DataItem[]
|
70
84
|
|
71
|
-
@OneToMany(type => DataSample, dataSample => dataSample.dataSet)
|
72
|
-
@Field(type => [DataSample], { nullable: true })
|
73
|
-
dataSamples: DataSample[]
|
74
|
-
|
75
85
|
@Column({
|
76
86
|
nullable: true
|
77
87
|
})
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { DataSpec } from './data-spec'
|
2
|
+
|
3
|
+
export class DataSpecManager {
|
4
|
+
static specRegistry: { [type: string]: DataSpec } = {}
|
5
|
+
|
6
|
+
static getDataSpec(type: string): DataSpec {
|
7
|
+
return DataSpecManager.specRegistry[type]
|
8
|
+
}
|
9
|
+
|
10
|
+
static registerDataSpec(type: string, dataSpec: DataSpec) {
|
11
|
+
DataSpecManager.specRegistry[type] = dataSpec
|
12
|
+
}
|
13
|
+
|
14
|
+
static unregisterDataSpec(type: string) {
|
15
|
+
delete DataSpecManager.specRegistry[type]
|
16
|
+
}
|
17
|
+
|
18
|
+
static getDataSpecs(): DataSpec[] {
|
19
|
+
return Object.values(DataSpecManager.specRegistry)
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Resolver, Query, Arg } from 'type-graphql'
|
2
|
+
import { DataSpec, DataSpecList } from './data-spec'
|
3
|
+
import { DataSpecManager } from './data-spec-manager'
|
4
|
+
|
5
|
+
@Resolver(DataSpec)
|
6
|
+
export class DataSpecQuery {
|
7
|
+
@Query(returns => DataSpec, { description: 'To fetch a data-spec' })
|
8
|
+
dataSpec(@Arg('name') name: string): DataSpec {
|
9
|
+
return DataSpecManager.getDataSpec(name)
|
10
|
+
}
|
11
|
+
|
12
|
+
@Query(returns => DataSpecList, { description: 'To fetch all data-specs' })
|
13
|
+
dataSpecs(): DataSpecList {
|
14
|
+
const items = DataSpecManager.getDataSpecs()
|
15
|
+
|
16
|
+
return {
|
17
|
+
items,
|
18
|
+
total: items.length
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { ObjectType, Field, Int } from 'type-graphql'
|
2
|
+
import { ScalarObject } from '@things-factory/shell'
|
3
|
+
|
4
|
+
@ObjectType()
|
5
|
+
export class DataSpecItem {
|
6
|
+
@Field()
|
7
|
+
type: string
|
8
|
+
|
9
|
+
@Field()
|
10
|
+
label: string
|
11
|
+
|
12
|
+
@Field()
|
13
|
+
name: string
|
14
|
+
|
15
|
+
@Field({ nullable: true })
|
16
|
+
placeholder?: string
|
17
|
+
|
18
|
+
@Field(type => ScalarObject, { nullable: true })
|
19
|
+
property?: ScalarObject
|
20
|
+
}
|
21
|
+
|
22
|
+
@ObjectType()
|
23
|
+
export class DataSpec {
|
24
|
+
@Field()
|
25
|
+
name: string
|
26
|
+
|
27
|
+
@Field({ nullable: true })
|
28
|
+
description: string
|
29
|
+
|
30
|
+
@Field({ nullable: true })
|
31
|
+
help: string
|
32
|
+
|
33
|
+
@Field(type => [DataSpecItem], { nullable: true })
|
34
|
+
specItems: DataSpecItem[]
|
35
|
+
}
|
36
|
+
|
37
|
+
@ObjectType()
|
38
|
+
export class DataSpecList {
|
39
|
+
@Field(type => [DataSpec])
|
40
|
+
items: DataSpec[]
|
41
|
+
|
42
|
+
@Field(type => Int)
|
43
|
+
total: number
|
44
|
+
}
|
package/server/service/index.ts
CHANGED
@@ -1,29 +1,37 @@
|
|
1
|
+
import { entities as DataItemEntities, resolvers as DataItemResolvers } from './data-item'
|
1
2
|
/* IMPORT ENTITIES AND RESOLVERS */
|
2
|
-
import { entities as
|
3
|
+
import { entities as DataOocEntities, resolvers as DataOocResolvers } from './data-ooc'
|
3
4
|
import { entities as DataSampleEntities, resolvers as DataSampleResolvers } from './data-sample'
|
4
|
-
import { entities as
|
5
|
+
import { entities as DataSensorEntities, resolvers as DataSensorResolvers } from './data-sensor'
|
5
6
|
import { entities as DataSetEntities, resolvers as DataSetResolvers } from './data-set'
|
7
|
+
import { entities as DataSpecEntities, resolvers as DataSpecResolvers } from './data-spec'
|
6
8
|
|
7
9
|
/* EXPORT ENTITY TYPES */
|
10
|
+
export * from './data-ooc/data-ooc'
|
8
11
|
export * from './data-sensor/data-sensor'
|
9
12
|
export * from './data-sample/data-sample'
|
10
13
|
export * from './data-item/data-item'
|
11
14
|
export * from './data-set/data-set'
|
15
|
+
export * from './data-spec/data-spec'
|
12
16
|
|
13
17
|
export const entities = [
|
14
18
|
/* ENTITIES */
|
15
|
-
|
16
|
-
|
19
|
+
...DataOocEntities,
|
20
|
+
...DataSensorEntities,
|
21
|
+
...DataSampleEntities,
|
17
22
|
...DataItemEntities,
|
18
|
-
...DataSetEntities
|
23
|
+
...DataSetEntities,
|
24
|
+
...DataSpecEntities
|
19
25
|
]
|
20
26
|
|
21
27
|
export const schema = {
|
22
28
|
resolverClasses: [
|
23
29
|
/* RESOLVER CLASSES */
|
24
|
-
|
25
|
-
|
30
|
+
...DataOocResolvers,
|
31
|
+
...DataSensorResolvers,
|
32
|
+
...DataSampleResolvers,
|
26
33
|
...DataItemResolvers,
|
27
|
-
...DataSetResolvers
|
34
|
+
...DataSetResolvers,
|
35
|
+
...DataSpecResolvers
|
28
36
|
]
|
29
37
|
}
|
package/things-factory.config.js
CHANGED
package/translations/en.json
CHANGED
@@ -1,19 +1,38 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "corrected",
|
3
|
+
"button.reviewed": "reviewed",
|
2
4
|
"field.appliance": "appliance",
|
3
5
|
"field.collected_at": "collected at",
|
6
|
+
"field.corrective-action": "corrective action",
|
7
|
+
"field.corrector": "corrector",
|
8
|
+
"field.corrected-at": "corrected at",
|
4
9
|
"field.data": "data",
|
10
|
+
"field.data-sample": "data sample",
|
5
11
|
"field.data-set": "data set",
|
6
12
|
"field.device-id": "device id",
|
7
13
|
"field.netmask": "network mask",
|
14
|
+
"field.oos": "out of critical limit",
|
15
|
+
"field.ooc": "out of control limit",
|
16
|
+
"field.options": "options",
|
8
17
|
"field.partition-keys": "partition keys",
|
9
18
|
"field.quota": "sampling #",
|
10
19
|
"field.raw-data": "raw data",
|
11
20
|
"field.ref-by": "ref. by",
|
12
21
|
"field.serial-no": "serial #",
|
13
22
|
"field.spec": "spec",
|
23
|
+
"field.state": "state",
|
24
|
+
"field.supervisory-role": "supervisory role",
|
14
25
|
"field.tag": "tag name",
|
26
|
+
"field.unit": "unit",
|
27
|
+
"field.use-case": "use case",
|
28
|
+
"text.data sample created successfully": "a data sample created successfully",
|
29
|
+
"text.data ooc updated successfully": "a data ooc updated successfully",
|
30
|
+
"title.data-entry-form": "data entry form",
|
15
31
|
"title.data-item list": "data item list",
|
32
|
+
"title.data-ooc list": "data OOC list",
|
33
|
+
"title.data-ooc view": "data OOC view",
|
16
34
|
"title.data-sample list": "data sample list",
|
35
|
+
"title.data-sample view": "data sample view",
|
17
36
|
"title.data-sensor list": "data sensor list",
|
18
37
|
"title.data-set list": "data set list"
|
19
|
-
}
|
38
|
+
}
|
package/translations/ko.json
CHANGED
@@ -1,19 +1,38 @@
|
|
1
1
|
{
|
2
|
+
"button.corrected": "조치완료",
|
3
|
+
"button.reviewed": "검토완료",
|
2
4
|
"field.appliance": "어플라이언스",
|
3
5
|
"field.collected_at": "수집일시",
|
6
|
+
"field.corrective-action": "조치 활동",
|
7
|
+
"field.corrector": "조치자",
|
8
|
+
"field.corrected-at": "조치 시간",
|
4
9
|
"field.data": "데이타",
|
10
|
+
"field.data-sample": "데이타 샘플",
|
5
11
|
"field.data-set": "데이타셋",
|
6
12
|
"field.device-id": "디바이스 아이디",
|
7
13
|
"field.netmask": "네트워크마스크",
|
14
|
+
"field.oos": "허용한계 이탈여부",
|
15
|
+
"field.ooc": "관리한계 이탈여부",
|
16
|
+
"field.options": "선택옵션",
|
8
17
|
"field.partition-keys": "파티션 키",
|
9
18
|
"field.quota": "샘플수",
|
10
19
|
"field.raw-data": "데이타 원본",
|
11
20
|
"field.ref-by": "참조아이템",
|
12
21
|
"field.serial-no": "시리얼번호",
|
13
22
|
"field.spec": "명세",
|
14
|
-
"field.
|
23
|
+
"field.state": "상태",
|
24
|
+
"field.supervisory-role": "관리자 역할",
|
25
|
+
"field.tag": "태그이름",
|
26
|
+
"field.unit": "단위",
|
27
|
+
"field.use-case": "사용 사례",
|
28
|
+
"text.data sample created successfully": "데이타 샘플이 성공적으로 생성되었습니다",
|
29
|
+
"text.data ooc updated successfully": "이탈데이타 내용이 수정되었습니다",
|
30
|
+
"title.data-entry-form": "데이타 입력",
|
15
31
|
"title.data-item list": "데이타 아이템 조회",
|
32
|
+
"title.data-ooc list": "데이타 이탈점 조회",
|
33
|
+
"title.data-ooc view": "데이타 이탈점 상세",
|
16
34
|
"title.data-sample list": "데이타 샘플 조회",
|
35
|
+
"title.data-sample view": "데이타 샘플 상세",
|
17
36
|
"title.data-sensor list": "데이타 센서 조회",
|
18
37
|
"title.data-set list": "데이타 셋 조회"
|
19
|
-
}
|
38
|
+
}
|