@things-factory/shell 6.0.101 → 6.0.107
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/client/scene/scene-viewer.js +1 -1
- package/dist-server/service/attribute/attribute-item-type.d.ts +29 -0
- package/dist-server/service/attribute/attribute-item-type.js +81 -0
- package/dist-server/service/attribute/attribute-item-type.js.map +1 -0
- package/dist-server/service/attribute/attribute-mutation.d.ts +10 -0
- package/dist-server/service/attribute/attribute-mutation.js +130 -0
- package/dist-server/service/attribute/attribute-mutation.js.map +1 -0
- package/dist-server/service/attribute/attribute-query.d.ts +8 -0
- package/dist-server/service/attribute/attribute-query.js +60 -0
- package/dist-server/service/attribute/attribute-query.js.map +1 -0
- package/dist-server/service/attribute/attribute-type.d.ts +19 -0
- package/dist-server/service/attribute/attribute-type.js +70 -0
- package/dist-server/service/attribute/attribute-type.js.map +1 -0
- package/dist-server/service/attribute/attribute.d.ts +9 -0
- package/dist-server/service/attribute/attribute.js +52 -0
- package/dist-server/service/attribute/attribute.js.map +1 -0
- package/dist-server/service/attribute/index.d.ts +5 -0
- package/dist-server/service/attribute/index.js +9 -0
- package/dist-server/service/attribute/index.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.d.ts +31 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.js +89 -0
- package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.d.ts +10 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.js +130 -0
- package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-query.d.ts +8 -0
- package/dist-server/service/attribute-set/attribute-set-query.js +60 -0
- package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set-type.d.ts +19 -0
- package/dist-server/service/attribute-set/attribute-set-type.js +70 -0
- package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -0
- package/dist-server/service/attribute-set/attribute-set.d.ts +9 -0
- package/dist-server/service/attribute-set/attribute-set.js +52 -0
- package/dist-server/service/attribute-set/attribute-set.js.map +1 -0
- package/dist-server/service/attribute-set/index.d.ts +5 -0
- package/dist-server/service/attribute-set/index.js +9 -0
- package/dist-server/service/attribute-set/index.js.map +1 -0
- package/dist-server/service/domain/domain-resolver.d.ts +1 -1
- package/dist-server/service/domain/domain-resolver.js +3 -2
- package/dist-server/service/domain/domain-resolver.js.map +1 -1
- package/dist-server/service/domain/domain-types.d.ts +1 -0
- package/dist-server/service/domain/domain-types.js +5 -0
- package/dist-server/service/domain/domain-types.js.map +1 -1
- package/dist-server/service/domain/domain.d.ts +1 -0
- package/dist-server/service/domain/domain.js +6 -0
- package/dist-server/service/domain/domain.js.map +1 -1
- package/dist-server/service/index.d.ts +3 -2
- package/dist-server/service/index.js +4 -2
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/shell/attribute.md +160 -0
- package/package.json +2 -2
- package/server/service/attribute-set/attribute-set-item-type.ts +65 -0
- package/server/service/attribute-set/attribute-set-mutation.ts +125 -0
- package/server/service/attribute-set/attribute-set-query.ts +36 -0
- package/server/service/attribute-set/attribute-set-type.ts +46 -0
- package/server/service/attribute-set/attribute-set.ts +35 -0
- package/server/service/attribute-set/index.ts +6 -0
- package/server/service/domain/domain-resolver.ts +1 -1
- package/server/service/domain/domain-types.ts +4 -1
- package/server/service/domain/domain.ts +5 -0
- package/server/service/index.ts +5 -8
@@ -0,0 +1,160 @@
|
|
1
|
+
# Attribute
|
2
|
+
|
3
|
+
Paragraphs are separated by a blank line.
|
4
|
+
|
5
|
+
2nd paragraph. _Italic_, **bold**, and `monospace`. Itemized lists
|
6
|
+
look like:
|
7
|
+
|
8
|
+
- this one
|
9
|
+
- that one
|
10
|
+
- the other one
|
11
|
+
|
12
|
+
Note that --- not considering the asterisk --- the actual text
|
13
|
+
content starts at 4-columns in.
|
14
|
+
|
15
|
+
> Block quotes are
|
16
|
+
> written like so.
|
17
|
+
>
|
18
|
+
> They can span multiple paragraphs,
|
19
|
+
> if you like.
|
20
|
+
|
21
|
+
Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all
|
22
|
+
in chapters 12--14"). Three dots ... will be converted to an ellipsis.
|
23
|
+
Unicode is supported. ☺
|
24
|
+
|
25
|
+
## An h2 header
|
26
|
+
|
27
|
+
Here's a numbered list:
|
28
|
+
|
29
|
+
1. first item
|
30
|
+
2. second item
|
31
|
+
3. third item
|
32
|
+
|
33
|
+
Note again how the actual text starts at 4 columns in (4 characters
|
34
|
+
from the left side). Here's a code sample:
|
35
|
+
|
36
|
+
# Let me re-iterate ...
|
37
|
+
|
38
|
+
for i in 1 .. 10 { do-something(i) }
|
39
|
+
|
40
|
+
As you probably guessed, indented 4 spaces. By the way, instead of
|
41
|
+
indenting the block, you can use delimited blocks, if you like:
|
42
|
+
|
43
|
+
```
|
44
|
+
define foobar() {
|
45
|
+
print "Welcome to flavor country!";
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
(which makes copying & pasting easier). You can optionally mark the
|
50
|
+
delimited block for Pandoc to syntax highlight it:
|
51
|
+
|
52
|
+
```python
|
53
|
+
import time
|
54
|
+
# Quick, count to ten!
|
55
|
+
for i in range(10):
|
56
|
+
# (but not *too* quick)
|
57
|
+
time.sleep(0.5)
|
58
|
+
print(i)
|
59
|
+
```
|
60
|
+
|
61
|
+
### An h3 header
|
62
|
+
|
63
|
+
Now a nested list:
|
64
|
+
|
65
|
+
1. First, get these ingredients:
|
66
|
+
|
67
|
+
- carrots
|
68
|
+
- celery
|
69
|
+
- lentils
|
70
|
+
|
71
|
+
2. Boil some water.
|
72
|
+
|
73
|
+
3. Dump everything in the pot and follow
|
74
|
+
this algorithm:
|
75
|
+
|
76
|
+
find wooden spoon
|
77
|
+
uncover pot
|
78
|
+
stir
|
79
|
+
cover pot
|
80
|
+
balance wooden spoon precariously on pot handle
|
81
|
+
wait 10 minutes
|
82
|
+
goto first step (or shut off burner when done)
|
83
|
+
|
84
|
+
Do not bump wooden spoon or it will fall.
|
85
|
+
|
86
|
+
Notice again how text always lines up on 4-space indents (including
|
87
|
+
that last line which continues item 3 above).
|
88
|
+
|
89
|
+
Here's a link to [a website](http://foo.bar), to a [local
|
90
|
+
doc](local-doc.html), and to a [section heading in the current
|
91
|
+
doc](#an-h2-header). Here's a footnote [^1].
|
92
|
+
|
93
|
+
[^1]: Some footnote text.
|
94
|
+
|
95
|
+
Tables can look like this:
|
96
|
+
|
97
|
+
Name Size Material Color
|
98
|
+
|
99
|
+
---
|
100
|
+
|
101
|
+
All Business 9 leather brown
|
102
|
+
Roundabout 10 hemp canvas natural
|
103
|
+
Cinderella 11 glass transparent
|
104
|
+
|
105
|
+
Table: Shoes sizes, materials, and colors.
|
106
|
+
|
107
|
+
(The above is the caption for the table.) Pandoc also supports
|
108
|
+
multi-line tables:
|
109
|
+
|
110
|
+
---
|
111
|
+
|
112
|
+
Keyword Text
|
113
|
+
|
114
|
+
---
|
115
|
+
|
116
|
+
red Sunsets, apples, and
|
117
|
+
other red or reddish
|
118
|
+
things.
|
119
|
+
|
120
|
+
green Leaves, grass, frogs
|
121
|
+
and other things it's
|
122
|
+
not easy being.
|
123
|
+
|
124
|
+
---
|
125
|
+
|
126
|
+
A horizontal rule follows.
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
Here's a definition list:
|
131
|
+
|
132
|
+
apples
|
133
|
+
: Good for making applesauce.
|
134
|
+
|
135
|
+
oranges
|
136
|
+
: Citrus!
|
137
|
+
|
138
|
+
tomatoes
|
139
|
+
: There's no "e" in tomatoe.
|
140
|
+
|
141
|
+
Again, text is indented 4 spaces. (Put a blank line between each
|
142
|
+
term and its definition to spread things out more.)
|
143
|
+
|
144
|
+
Here's a "line block" (note how whitespace is honored):
|
145
|
+
|
146
|
+
| Line one
|
147
|
+
| Line too
|
148
|
+
| Line tree
|
149
|
+
|
150
|
+
and images can be specified like so:
|
151
|
+
|
152
|
+

|
153
|
+
|
154
|
+
Inline math equation: $\omega = d\phi / dt$. Display
|
155
|
+
math should get its own line like so:
|
156
|
+
|
157
|
+
$$I = \int \rho R^{2} dV$$
|
158
|
+
|
159
|
+
And note that you can backslash-escape any punctuation characters
|
160
|
+
which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.107",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -129,5 +129,5 @@
|
|
129
129
|
"pg": "^8.7.3",
|
130
130
|
"sqlite3": "^5.0.8"
|
131
131
|
},
|
132
|
-
"gitHead": "
|
132
|
+
"gitHead": "fa6d3ad23a445081db89b26e75a696fb46a38bd6"
|
133
133
|
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { Field, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
|
2
|
+
import { ScalarObject } from '../common-types'
|
3
|
+
|
4
|
+
export enum AttributeSetItemType {
|
5
|
+
number = 'number',
|
6
|
+
text = 'text',
|
7
|
+
boolean = 'boolean',
|
8
|
+
select = 'select',
|
9
|
+
date = 'date',
|
10
|
+
datetime = 'datetime',
|
11
|
+
file = 'file'
|
12
|
+
}
|
13
|
+
|
14
|
+
registerEnumType(AttributeSetItemType, {
|
15
|
+
name: 'AttributeSetItemType',
|
16
|
+
description: 'type enumeration of a attribute-set-item'
|
17
|
+
})
|
18
|
+
|
19
|
+
@ObjectType({ description: 'Entity for AttributeSetItem' })
|
20
|
+
export class AttributeSetItem {
|
21
|
+
@Field()
|
22
|
+
name: string
|
23
|
+
|
24
|
+
@Field({ nullable: true })
|
25
|
+
description?: string
|
26
|
+
|
27
|
+
@Field({ nullable: true })
|
28
|
+
tag?: string
|
29
|
+
|
30
|
+
@Field({ nullable: true })
|
31
|
+
active?: boolean
|
32
|
+
|
33
|
+
@Field({ nullable: true })
|
34
|
+
hidden?: boolean
|
35
|
+
|
36
|
+
@Field({ nullable: true })
|
37
|
+
type?: AttributeSetItemType
|
38
|
+
|
39
|
+
@Field(type => ScalarObject, { nullable: true })
|
40
|
+
options?: { [option: string]: any }
|
41
|
+
}
|
42
|
+
|
43
|
+
@InputType()
|
44
|
+
export class AttributeSetItemPatch {
|
45
|
+
@Field({ nullable: true })
|
46
|
+
name?: string
|
47
|
+
|
48
|
+
@Field({ nullable: true })
|
49
|
+
description?: string
|
50
|
+
|
51
|
+
@Field({ nullable: true })
|
52
|
+
tag?: string
|
53
|
+
|
54
|
+
@Field(type => AttributeSetItemType, { nullable: true })
|
55
|
+
type?: AttributeSetItemType
|
56
|
+
|
57
|
+
@Field(type => ScalarObject, { nullable: true })
|
58
|
+
options?: { [option: string]: any }
|
59
|
+
|
60
|
+
@Field({ nullable: true })
|
61
|
+
active?: boolean
|
62
|
+
|
63
|
+
@Field({ nullable: true })
|
64
|
+
hidden?: boolean
|
65
|
+
}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
+
import { In } from 'typeorm'
|
3
|
+
|
4
|
+
import { AttributeSet } from './attribute-set'
|
5
|
+
import { NewAttributeSet, AttributeSetPatch } from './attribute-set-type'
|
6
|
+
|
7
|
+
@Resolver(AttributeSet)
|
8
|
+
export class AttributeSetMutation {
|
9
|
+
@Directive('@transaction')
|
10
|
+
@Directive('@privilege(superUserGranted: true)')
|
11
|
+
@Mutation(returns => AttributeSet, { description: 'To create new AttributeSet' })
|
12
|
+
async createAttributeSet(@Arg('attribute') attribute: NewAttributeSet, @Ctx() context: any): Promise<AttributeSet> {
|
13
|
+
const { tx } = context.state
|
14
|
+
|
15
|
+
return await tx.getRepository(AttributeSet).save({
|
16
|
+
...attribute
|
17
|
+
})
|
18
|
+
}
|
19
|
+
|
20
|
+
@Directive('@transaction')
|
21
|
+
@Directive('@privilege(superUserGranted: true)')
|
22
|
+
@Mutation(returns => AttributeSet, { description: 'To modify AttributeSet information' })
|
23
|
+
async updateAttributeSet(
|
24
|
+
@Arg('id') id: string,
|
25
|
+
@Arg('patch') patch: AttributeSetPatch,
|
26
|
+
@Ctx() context: any
|
27
|
+
): Promise<AttributeSet> {
|
28
|
+
const { tx } = context.state
|
29
|
+
|
30
|
+
const repository = tx.getRepository(AttributeSet)
|
31
|
+
const attribute = await repository.findOne({
|
32
|
+
where: { id }
|
33
|
+
})
|
34
|
+
|
35
|
+
return await repository.save({
|
36
|
+
...attribute,
|
37
|
+
...patch
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
@Directive('@transaction')
|
42
|
+
@Directive('@privilege(superUserGranted: true)')
|
43
|
+
@Mutation(returns => [AttributeSet], { description: "To modify multiple AttributeSets' information" })
|
44
|
+
async updateMultipleAttributeSet(
|
45
|
+
@Arg('patches', type => [AttributeSetPatch]) patches: AttributeSetPatch[],
|
46
|
+
@Ctx() context: any
|
47
|
+
): Promise<AttributeSet[]> {
|
48
|
+
const { tx } = context.state
|
49
|
+
|
50
|
+
let results = []
|
51
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
52
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
53
|
+
const attributeRepo = tx.getRepository(AttributeSet)
|
54
|
+
|
55
|
+
if (_createRecords.length > 0) {
|
56
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
57
|
+
const newRecord = _createRecords[i]
|
58
|
+
|
59
|
+
const result = await attributeRepo.save({
|
60
|
+
...newRecord
|
61
|
+
})
|
62
|
+
|
63
|
+
results.push({ ...result, cuFlag: '+' })
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
if (_updateRecords.length > 0) {
|
68
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
69
|
+
const updateRecord = _updateRecords[i]
|
70
|
+
const attribute = await attributeRepo.findOneBy({ id: updateRecord.id })
|
71
|
+
|
72
|
+
const result = await attributeRepo.save({
|
73
|
+
...attribute,
|
74
|
+
...updateRecord
|
75
|
+
})
|
76
|
+
|
77
|
+
results.push({ ...result, cuFlag: 'M' })
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return results
|
82
|
+
}
|
83
|
+
|
84
|
+
@Directive('@transaction')
|
85
|
+
@Directive('@privilege(superUserGranted: true)')
|
86
|
+
@Mutation(returns => Boolean, { description: 'To delete AttributeSet' })
|
87
|
+
async deleteAttributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
88
|
+
const { tx } = context.state
|
89
|
+
|
90
|
+
await tx.getRepository(AttributeSet).delete({ id })
|
91
|
+
|
92
|
+
return true
|
93
|
+
}
|
94
|
+
|
95
|
+
@Directive('@transaction')
|
96
|
+
@Directive('@privilege(superUserGranted: true)')
|
97
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple AttributeSets' })
|
98
|
+
async deleteAttributeSets(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
99
|
+
const { tx } = context.state
|
100
|
+
|
101
|
+
await tx.getRepository(AttributeSet).delete({
|
102
|
+
id: In(ids)
|
103
|
+
})
|
104
|
+
|
105
|
+
return true
|
106
|
+
}
|
107
|
+
|
108
|
+
@Directive('@transaction')
|
109
|
+
@Directive('@privilege(superUserGranted: true)')
|
110
|
+
@Mutation(returns => Boolean, { description: 'To import multiple AttributeSets' })
|
111
|
+
async importAttributeSets(
|
112
|
+
@Arg('attributes', type => [AttributeSetPatch]) attributes: AttributeSetPatch[],
|
113
|
+
@Ctx() context: any
|
114
|
+
): Promise<boolean> {
|
115
|
+
const { tx } = context.state
|
116
|
+
|
117
|
+
await Promise.all(
|
118
|
+
attributes.map(async (attribute: AttributeSetPatch) => {
|
119
|
+
await tx.getRepository(AttributeSet).save(attribute)
|
120
|
+
})
|
121
|
+
)
|
122
|
+
|
123
|
+
return true
|
124
|
+
}
|
125
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
+
import { AttributeSet } from './attribute-set'
|
3
|
+
import { AttributeSetList } from './attribute-set-type'
|
4
|
+
import { ListParam } from '../common-types'
|
5
|
+
import { getRepository } from '../../initializers/database'
|
6
|
+
import { getQueryBuilderFromListParams } from '../../utils'
|
7
|
+
|
8
|
+
@Resolver(AttributeSet)
|
9
|
+
export class AttributeSetQuery {
|
10
|
+
@Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet' })
|
11
|
+
async attributeSet(@Arg('id') id: string, @Ctx() context: any): Promise<AttributeSet> {
|
12
|
+
return await getRepository(AttributeSet).findOne({
|
13
|
+
where: { id }
|
14
|
+
})
|
15
|
+
}
|
16
|
+
|
17
|
+
@Query(returns => AttributeSet!, { nullable: true, description: 'To fetch a AttributeSet by Entity name' })
|
18
|
+
async attributeSetByEntity(@Arg('entity') entity: string, @Ctx() context: any): Promise<AttributeSet> {
|
19
|
+
return await getRepository(AttributeSet).findOne({
|
20
|
+
where: { entity }
|
21
|
+
})
|
22
|
+
}
|
23
|
+
|
24
|
+
@Query(returns => AttributeSetList, { description: 'To fetch multiple AttributeSets' })
|
25
|
+
async attributeSets(@Args() params: ListParam, @Ctx() context: any): Promise<AttributeSetList> {
|
26
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
27
|
+
params,
|
28
|
+
repository: await getRepository(AttributeSet),
|
29
|
+
searchables: ['entity', 'description']
|
30
|
+
})
|
31
|
+
|
32
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
33
|
+
|
34
|
+
return { items, total }
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
2
|
+
|
3
|
+
import { AttributeSet } from './attribute-set'
|
4
|
+
import { AttributeSetItemPatch } from './attribute-set-item-type'
|
5
|
+
|
6
|
+
@InputType()
|
7
|
+
export class NewAttributeSet {
|
8
|
+
@Field()
|
9
|
+
entity: string
|
10
|
+
|
11
|
+
@Field({ nullable: true })
|
12
|
+
description?: string
|
13
|
+
|
14
|
+
@Field(type => [AttributeSetItemPatch], { nullable: true })
|
15
|
+
items?: AttributeSetItemPatch[]
|
16
|
+
|
17
|
+
@Field({ nullable: true })
|
18
|
+
active?: boolean
|
19
|
+
}
|
20
|
+
|
21
|
+
@InputType()
|
22
|
+
export class AttributeSetPatch {
|
23
|
+
@Field(type => ID, { nullable: true })
|
24
|
+
id?: string
|
25
|
+
|
26
|
+
@Field({ nullable: true })
|
27
|
+
entity?: string
|
28
|
+
|
29
|
+
@Field({ nullable: true })
|
30
|
+
description?: string
|
31
|
+
|
32
|
+
@Field(type => [AttributeSetItemPatch], { nullable: true })
|
33
|
+
items?: AttributeSetItemPatch[]
|
34
|
+
|
35
|
+
@Field({ nullable: true })
|
36
|
+
cuFlag?: string
|
37
|
+
}
|
38
|
+
|
39
|
+
@ObjectType()
|
40
|
+
export class AttributeSetList {
|
41
|
+
@Field(type => [AttributeSet])
|
42
|
+
items: AttributeSet[]
|
43
|
+
|
44
|
+
@Field(type => Int)
|
45
|
+
total: number
|
46
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'
|
2
|
+
import { ObjectType, Field, ID } from 'type-graphql'
|
3
|
+
|
4
|
+
import { AttributeSetItem } from './attribute-set-item-type'
|
5
|
+
|
6
|
+
@Entity()
|
7
|
+
@Index('ix_attribute_set_0', (attributeSet: AttributeSet) => [attributeSet.entity], {
|
8
|
+
unique: true
|
9
|
+
})
|
10
|
+
@ObjectType({ description: 'Entity for AttributeSet' })
|
11
|
+
export class AttributeSet {
|
12
|
+
@PrimaryGeneratedColumn('uuid')
|
13
|
+
@Field(type => ID)
|
14
|
+
readonly id: string
|
15
|
+
|
16
|
+
@Column({ nullable: true, default: '' })
|
17
|
+
@Field({ nullable: true })
|
18
|
+
entity: string = ''
|
19
|
+
|
20
|
+
@Column({ nullable: true, default: '' })
|
21
|
+
@Field({ nullable: true })
|
22
|
+
description: string = ''
|
23
|
+
|
24
|
+
@Column('simple-json', { nullable: true })
|
25
|
+
@Field(type => [AttributeSetItem], { nullable: true })
|
26
|
+
items: AttributeSetItem[]
|
27
|
+
|
28
|
+
@CreateDateColumn()
|
29
|
+
@Field({ nullable: true })
|
30
|
+
createdAt?: Date
|
31
|
+
|
32
|
+
@UpdateDateColumn()
|
33
|
+
@Field({ nullable: true })
|
34
|
+
updatedAt?: Date
|
35
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { AttributeSet } from './attribute-set'
|
2
|
+
import { AttributeSetQuery } from './attribute-set-query'
|
3
|
+
import { AttributeSetMutation } from './attribute-set-mutation'
|
4
|
+
|
5
|
+
export const entities = [AttributeSet]
|
6
|
+
export const resolvers = [AttributeSetQuery, AttributeSetMutation]
|
@@ -14,7 +14,7 @@ import { DomainList, DomainPatch } from './domain-types'
|
|
14
14
|
export class DomainResolver {
|
15
15
|
@Directive('@privilege(category: "system", privilege: "query", domainOwnerGranted: true, superUserGranted: true)')
|
16
16
|
@Query(returns => Domain, { description: 'To fetch domain' })
|
17
|
-
async domain(@Arg('id') id: string): Promise<Domain> {
|
17
|
+
async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {
|
18
18
|
const repository = getRepository(Domain)
|
19
19
|
|
20
20
|
return await repository.findOneBy({ id })
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ObjectType, InputType, Field, Int } from 'type-graphql'
|
2
2
|
import { Domain } from './domain'
|
3
|
-
import {
|
3
|
+
import { ScalarObject } from '../common-types'
|
4
4
|
|
5
5
|
@InputType()
|
6
6
|
export class DomainInput {
|
@@ -40,6 +40,9 @@ export class DomainPatch {
|
|
40
40
|
@Field({ nullable: true })
|
41
41
|
contentImage?: string
|
42
42
|
|
43
|
+
@Field(type => ScalarObject, { nullable: true })
|
44
|
+
attributes?: any
|
45
|
+
|
43
46
|
@Field({ nullable: true })
|
44
47
|
theme?: string
|
45
48
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Column, CreateDateColumn, Entity, Index, UpdateDateColumn } from 'typeorm'
|
2
2
|
import { ObjectType, Field, ID } from 'type-graphql'
|
3
3
|
import { config } from '@things-factory/env'
|
4
|
+
import { ScalarObject } from '../common-types'
|
4
5
|
|
5
6
|
const numericTypes = ['int', 'int2', 'int4', 'int8', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint']
|
6
7
|
const generatedStrategy = ['uuid', 'rowid', 'increment', 'identity']
|
@@ -109,6 +110,10 @@ export class Domain {
|
|
109
110
|
})
|
110
111
|
theme: string
|
111
112
|
|
113
|
+
@Column('simple-json', { nullable: true })
|
114
|
+
@Field(type => ScalarObject, { nullable: true })
|
115
|
+
attributes?: any
|
116
|
+
|
112
117
|
@Field({ nullable: true })
|
113
118
|
@CreateDateColumn()
|
114
119
|
createdAt: Date
|
package/server/service/index.ts
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
import { transactionDirectiveResolver, transactionDirectiveTypeDefs } from './directive-transaction'
|
2
|
-
import {
|
3
|
-
|
4
|
-
entities as DomainEntities,
|
5
|
-
resolvers as DataResolvers,
|
6
|
-
resolvers as DomainResolvers
|
7
|
-
} from './domain'
|
2
|
+
import { entities as DomainEntities, resolvers as DomainResolvers } from './domain'
|
3
|
+
import { entities as AttributeEntities, resolvers as AttributeResolvers } from './attribute-set'
|
8
4
|
import { resolvers as SubscriptionDataResolvers } from './subscription-data'
|
9
5
|
|
10
6
|
export * from './common-types'
|
11
7
|
export * from './domain/domain'
|
8
|
+
export * from './domain/domain'
|
12
9
|
|
13
10
|
/* EXPORT TYPES */
|
14
11
|
export * from './domain/domain-types'
|
@@ -16,7 +13,7 @@ export * from './subscription-data/data-types'
|
|
16
13
|
|
17
14
|
export const entities = [
|
18
15
|
/* Entities */
|
19
|
-
...
|
16
|
+
...AttributeEntities,
|
20
17
|
...DomainEntities
|
21
18
|
]
|
22
19
|
export const schema = {
|
@@ -25,7 +22,7 @@ export const schema = {
|
|
25
22
|
},
|
26
23
|
resolverClasses: [
|
27
24
|
/* Resolvers */
|
28
|
-
...
|
25
|
+
...AttributeResolvers,
|
29
26
|
...DomainResolvers,
|
30
27
|
...SubscriptionDataResolvers
|
31
28
|
],
|