@things-factory/meta-ui 7.0.1-alpha.65 → 7.0.1-alpha.66
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/utils/meta-ui-util.js +0 -125
- package/client/utils/service-util.js +0 -27
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/meta-ui-util.d.ts +0 -11
- package/dist-client/utils/meta-ui-util.js +0 -112
- package/dist-client/utils/meta-ui-util.js.map +1 -1
- package/dist-client/utils/service-util.d.ts +0 -5
- package/dist-client/utils/service-util.js +0 -25
- package/dist-client/utils/service-util.js.map +1 -1
- package/dist-server/service/index.js +0 -4
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/server/service/index.ts +0 -4
- package/translations/en.json +0 -1
- package/translations/ko.json +0 -1
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
- package/client/pages/personalize/personal-column-selector.ts +0 -259
- package/server/service/grid-personalize/grid-personalize-mutation.ts +0 -142
- package/server/service/grid-personalize/grid-personalize-query.ts +0 -60
- package/server/service/grid-personalize/grid-personalize-type.ts +0 -43
- package/server/service/grid-personalize/grid-personalize.ts +0 -76
- package/server/service/grid-personalize/index.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/meta-ui",
|
|
3
|
-
"version": "7.0.1-alpha.
|
|
3
|
+
"version": "7.0.1-alpha.66",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@things-factory/env": "^7.0.1-alpha.55",
|
|
44
44
|
"@things-factory/id-rule-base": "^7.0.1-alpha.64",
|
|
45
45
|
"@things-factory/menu-base": "^7.0.1-alpha.64",
|
|
46
|
-
"@things-factory/personalization": "^7.0.1-alpha.
|
|
46
|
+
"@things-factory/personalization": "^7.0.1-alpha.66",
|
|
47
47
|
"@things-factory/resource-base": "^7.0.1-alpha.64",
|
|
48
48
|
"@things-factory/shell": "^7.0.1-alpha.64",
|
|
49
|
-
"@things-factory/worklist": "^7.0.1-alpha.
|
|
49
|
+
"@things-factory/worklist": "^7.0.1-alpha.66",
|
|
50
50
|
"moment-timezone": "^0.5.45"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "28d4da7e711b1c5419783fa1ce8b0e9ac280d42a"
|
|
53
53
|
}
|
package/server/service/index.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/* EXPORT ENTITY TYPES */
|
|
2
|
-
export * from './grid-personalize/grid-personalize'
|
|
3
2
|
export * from './button-role/button-role'
|
|
4
3
|
export * from './menu-button-auth/menu-button-auth'
|
|
5
4
|
export * from './work-code-detail/work-code-detail'
|
|
6
5
|
export * from './work-code/work-code'
|
|
7
6
|
|
|
8
7
|
/* IMPORT ENTITIES AND RESOLVERS */
|
|
9
|
-
import { entities as GridPersonalizeEntities, resolvers as GridPersonalizeResolvers } from './grid-personalize'
|
|
10
8
|
import { entities as ButtonRoleEntities, resolvers as ButtonRoleResolvers } from './button-role'
|
|
11
9
|
import { entities as MenuButtonAuthEntities, resolvers as MenuButtonAuthResolvers } from './menu-button-auth'
|
|
12
10
|
import { resolvers as SetTranslationResolvers } from './set-translations'
|
|
@@ -18,7 +16,6 @@ import { subscribers as EntityEventSubscriber } from './entity-event-subscriber'
|
|
|
18
16
|
|
|
19
17
|
export const entities = [
|
|
20
18
|
/* ENTITIES */
|
|
21
|
-
...GridPersonalizeEntities,
|
|
22
19
|
...ButtonRoleEntities,
|
|
23
20
|
...MenuButtonAuthEntities,
|
|
24
21
|
...WorkCodeDetailEntities,
|
|
@@ -28,7 +25,6 @@ export const entities = [
|
|
|
28
25
|
export const schema = {
|
|
29
26
|
resolverClasses: [
|
|
30
27
|
/* RESOLVER CLASSES */
|
|
31
|
-
...GridPersonalizeResolvers,
|
|
32
28
|
...ButtonRoleResolvers,
|
|
33
29
|
...MenuButtonAuthResolvers,
|
|
34
30
|
...SetTranslationResolvers,
|
package/translations/en.json
CHANGED
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"title.dynamic_menu": "Dynamic Menu",
|
|
35
35
|
"title.entity": "Entity",
|
|
36
36
|
"title.entity-column": "Entity Columns",
|
|
37
|
-
"title.grid-column-personalize": "Grid Column Personalize",
|
|
38
37
|
"title.menu_group": "Menu Group",
|
|
39
38
|
"title.system_settings": "System Settings",
|
|
40
39
|
"title.terminology": "Terminology",
|
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"title.dynamic_menu": "Dynamic Menu",
|
|
35
35
|
"title.entity": "Entity",
|
|
36
36
|
"title.entity-column": "Entity Columns",
|
|
37
|
-
"title.grid-column-personalize": "Grid Column Personalize",
|
|
38
37
|
"title.menu_group": "Menu Group",
|
|
39
38
|
"title.system_settings": "System Settings",
|
|
40
39
|
"title.terminology": "Terminology",
|
package/translations/zh.json
CHANGED
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"title.dynamic_menu": "Dynamic Menu",
|
|
35
35
|
"title.entity": "Entity",
|
|
36
36
|
"title.entity-column": "Entity Columns",
|
|
37
|
-
"title.grid-column-personalize": "Grid Column Personalize",
|
|
38
37
|
"title.menu_group": "Menu Group",
|
|
39
38
|
"title.system_settings": "System Settings",
|
|
40
39
|
"title.terminology": "Terminology",
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
|
|
3
|
-
import gql from 'graphql-tag'
|
|
4
|
-
import { css, html, LitElement } from 'lit'
|
|
5
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
|
-
|
|
7
|
-
import { i18next, localize } from '@operato/i18n'
|
|
8
|
-
import { client } from '@operato/graphql'
|
|
9
|
-
import { DataGrist } from '@operato/data-grist'
|
|
10
|
-
import { ScrollbarStyles, CommonGristStyles, ButtonContainerStyles } from '@operato/styles'
|
|
11
|
-
|
|
12
|
-
import { TermsUtil } from './../../utils/terms-util'
|
|
13
|
-
import { MetaApi } from '../../utils/meta-api'
|
|
14
|
-
import { ServiceUtil } from '../../utils/service-util'
|
|
15
|
-
import { UiUtil } from '../../utils/ui-util'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @license
|
|
19
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
20
|
-
* @author Yang <wryang@hatiolab.com>
|
|
21
|
-
* @description 사용자 그리드 컬럼 개인화 팝업
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
@customElement('personal-column-selector')
|
|
25
|
-
export class PersonalColumnSelector extends localize(i18next)(LitElement) {
|
|
26
|
-
/**
|
|
27
|
-
* @description 스타일 정의
|
|
28
|
-
***********************************
|
|
29
|
-
* @returns {Object} 화면의 스타일 정의
|
|
30
|
-
*/
|
|
31
|
-
static styles = [
|
|
32
|
-
ScrollbarStyles,
|
|
33
|
-
CommonGristStyles,
|
|
34
|
-
ButtonContainerStyles,
|
|
35
|
-
css`
|
|
36
|
-
:host {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
overflow-x: auto;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.container {
|
|
43
|
-
flex: 1;
|
|
44
|
-
display: grid;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.container_detail {
|
|
49
|
-
background-color: var(--main-section-background-color);
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
flex: 1;
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
h2 {
|
|
57
|
-
padding: var(--subtitle-padding);
|
|
58
|
-
font: var(--subtitle-font);
|
|
59
|
-
color: var(--subtitle-text-color);
|
|
60
|
-
border-bottom: var(--subtitle-border-bottom);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.container_detail h2 {
|
|
64
|
-
margin: var(--grist-title-margin);
|
|
65
|
-
border: var(--grist-title-border);
|
|
66
|
-
font: var(--grist-title-font);
|
|
67
|
-
color: var(--secondary-color);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.container_detail h2 md-icon {
|
|
71
|
-
--md-icon-size: var(--grist-title-icon-size);
|
|
72
|
-
vertical-align: middle;
|
|
73
|
-
margin: var(--grist-title-icon-margin);
|
|
74
|
-
color: var(--grist-title-icon-color);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
h2 {
|
|
78
|
-
padding-bottom: var(--grist-title-with-grid-padding);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
ox-grist {
|
|
82
|
-
overflow-y: auto;
|
|
83
|
-
flex: 1;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
ox-filters-form {
|
|
87
|
-
flex: 1;
|
|
88
|
-
}
|
|
89
|
-
`
|
|
90
|
-
]
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @description 선택된 그리드
|
|
94
|
-
*/
|
|
95
|
-
@property({ type: Object }) configGrist: any
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @description 메뉴 ID
|
|
99
|
-
*/
|
|
100
|
-
@property({ type: String }) menuId!: string
|
|
101
|
-
|
|
102
|
-
@query('ox-grist') private grist!: DataGrist
|
|
103
|
-
|
|
104
|
-
private gridConfig: any
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @description 라이프 사이클
|
|
108
|
-
***************************
|
|
109
|
-
*/
|
|
110
|
-
async connectedCallback() {
|
|
111
|
-
// 메뉴 그룹 그리드 설정
|
|
112
|
-
this.gridConfig = {
|
|
113
|
-
rows: { selectable: false, appendable: false },
|
|
114
|
-
pagination: { infinite: true },
|
|
115
|
-
columns: [
|
|
116
|
-
...MetaApi.getGristGuttersConfig(false, false),
|
|
117
|
-
MetaApi.getGristColumnConfig('integer', 'rank', 'center', true, false, 80),
|
|
118
|
-
MetaApi.getGristColumnConfig('string', 'name', 'left', false, false, 180),
|
|
119
|
-
MetaApi.getGristColumnConfig2('string', 'header', 'display', 'left', false, false, 180),
|
|
120
|
-
MetaApi.getGristColumnConfig('boolean', 'hidden', 'center', true, false, 60)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
await super.connectedCallback()
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @description 라이프 사이클
|
|
129
|
-
***************************
|
|
130
|
-
*/
|
|
131
|
-
render() {
|
|
132
|
-
return html` <div id="container" class="container">
|
|
133
|
-
<div class="container_detail">
|
|
134
|
-
<ox-grist
|
|
135
|
-
id="ox-grist"
|
|
136
|
-
.config=${this.gridConfig}
|
|
137
|
-
.mode=${'GRID'}
|
|
138
|
-
auto-fetch
|
|
139
|
-
.fetchHandler=${this.fetchColumns.bind(this)}
|
|
140
|
-
>
|
|
141
|
-
</ox-grist>
|
|
142
|
-
|
|
143
|
-
<div class="button-container" style="margin-left:unset">
|
|
144
|
-
<button @click=${this.reset.bind(this)}><md-icon>restart_alt</md-icon>${TermsUtil.tButton('reset')}</button>
|
|
145
|
-
<div filler></div>
|
|
146
|
-
<button @click=${this.save.bind(this)}><md-icon>save</md-icon>${TermsUtil.tButton('save')}</button>
|
|
147
|
-
<button danger @click=${this.delete.bind(this)}>
|
|
148
|
-
<md-icon>delete</md-icon>${TermsUtil.tButton('delete')}
|
|
149
|
-
</button>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>`
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* @description 컬럼 조회
|
|
157
|
-
***************************
|
|
158
|
-
* @returns
|
|
159
|
-
*/
|
|
160
|
-
async fetchColumns() {
|
|
161
|
-
// 팝업 오프너에서 받아온 그리스트의 설정으로 보여준다
|
|
162
|
-
let cols = this.configGrist.config.columns
|
|
163
|
-
let filterCols = cols.filter(x => x.type != 'gutter' && x.name != 'id' && x.unusable !== true)
|
|
164
|
-
let rank = 0
|
|
165
|
-
|
|
166
|
-
let items = filterCols.map(x => {
|
|
167
|
-
rank = rank + 10
|
|
168
|
-
x.rank = rank
|
|
169
|
-
return x
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
return { total: 0, records: items }
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @description 개인화 데이터 삭제
|
|
177
|
-
***************************
|
|
178
|
-
* @returns
|
|
179
|
-
*/
|
|
180
|
-
async delete(e: MouseEvent) {
|
|
181
|
-
let personal = await MetaApi.getMyMenuGridPersnal(this.menuId)
|
|
182
|
-
let { id = undefined } = personal
|
|
183
|
-
|
|
184
|
-
if (id) {
|
|
185
|
-
let result = await ServiceUtil.deleteListByIds([id], 'deleteGridPersonalizes')
|
|
186
|
-
if (result == true) {
|
|
187
|
-
history.back()
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
190
|
-
await MetaApi.showToast('info', 'there_is_nothing_to_delete')
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* @description 개인화 그리드 초기화
|
|
196
|
-
************************************************
|
|
197
|
-
*/
|
|
198
|
-
async reset(e: MouseEvent) {
|
|
199
|
-
await this.grist.fetch()
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @description 컬럼 변경 사항 저장
|
|
204
|
-
************************************************
|
|
205
|
-
*/
|
|
206
|
-
async save(e: MouseEvent) {
|
|
207
|
-
// 변경 체크
|
|
208
|
-
MetaApi.patchesForUpdateMultiple(this.grist)
|
|
209
|
-
|
|
210
|
-
// 기존 데이터 조회
|
|
211
|
-
const { template = {} } = (await MetaApi.getMyMenuGridPersnal(this.menuId)) || {}
|
|
212
|
-
|
|
213
|
-
let tempName = 'master'
|
|
214
|
-
if (this.configGrist.configName) {
|
|
215
|
-
tempName = this.configGrist.configName
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// 기존 데이터 삭제
|
|
219
|
-
if (template[tempName]) {
|
|
220
|
-
delete template[tempName]
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// 그리드 설정 데이터 숨김 필드 제외 후 정렬
|
|
224
|
-
let records = this.grist.dirtyData.records
|
|
225
|
-
let data = records.filter(x => x.hidden == false)
|
|
226
|
-
data.sort((a, b) => {
|
|
227
|
-
return a.rank - b.rank
|
|
228
|
-
})
|
|
229
|
-
template[tempName] = data.map(x => {
|
|
230
|
-
return x.name
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
try {
|
|
234
|
-
const response = await client.query({
|
|
235
|
-
query: gql`
|
|
236
|
-
mutation ($menuId: String!, $template: Object!) {
|
|
237
|
-
saveMyGridpersonalize(menuId: $menuId, template: $template) {
|
|
238
|
-
id
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
`,
|
|
242
|
-
variables: {
|
|
243
|
-
menuId: this.menuId,
|
|
244
|
-
template
|
|
245
|
-
}
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
if (!response.errors) {
|
|
249
|
-
UiUtil.showToast('info', TermsUtil.tText('success to save'))
|
|
250
|
-
} else {
|
|
251
|
-
ServiceUtil.showGraphqlErrorResponse(response)
|
|
252
|
-
}
|
|
253
|
-
} catch (e) {
|
|
254
|
-
ServiceUtil.showGraphqlException(e)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
history.back()
|
|
258
|
-
}
|
|
259
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { GridPersonalize } from './grid-personalize'
|
|
4
|
-
import { NewGridPersonalize, GridPersonalizePatch } from './grid-personalize-type'
|
|
5
|
-
import { ScalarObject } from '@things-factory/shell'
|
|
6
|
-
|
|
7
|
-
@Resolver(GridPersonalize)
|
|
8
|
-
export class GridPersonalizeMutation {
|
|
9
|
-
@Directive('@transaction')
|
|
10
|
-
@Mutation(returns => GridPersonalize, { description: 'To create new Gridpersonalize' })
|
|
11
|
-
async createGridpersonalize(
|
|
12
|
-
@Arg('gridpersonalize') gridPersonalize: NewGridPersonalize,
|
|
13
|
-
@Ctx() context: any
|
|
14
|
-
): Promise<GridPersonalize> {
|
|
15
|
-
const { domain, user, tx } = context.state
|
|
16
|
-
|
|
17
|
-
return await tx.getRepository(GridPersonalize).save({
|
|
18
|
-
...gridPersonalize,
|
|
19
|
-
domain,
|
|
20
|
-
creator: user,
|
|
21
|
-
updater: user
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Directive('@transaction')
|
|
26
|
-
@Mutation(returns => GridPersonalize, { description: 'To create or update my Gridpersonalize' })
|
|
27
|
-
async saveMyGridpersonalize(
|
|
28
|
-
@Arg('menuId') menuId: string,
|
|
29
|
-
@Arg('template', type => ScalarObject) template: { [key: string]: string[] },
|
|
30
|
-
@Ctx() context: any
|
|
31
|
-
): Promise<GridPersonalize> {
|
|
32
|
-
const { domain, user, tx } = context.state
|
|
33
|
-
|
|
34
|
-
if (!menuId) {
|
|
35
|
-
throw 'menuId required.'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const gridpersonalize = await tx.getRepository(GridPersonalize).findOne({
|
|
39
|
-
where: { domain: { id: domain.id }, menu: { id: menuId }, user: { id: user.id } }
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
return await tx.getRepository(GridPersonalize).save({
|
|
43
|
-
...gridpersonalize,
|
|
44
|
-
domain,
|
|
45
|
-
menu: { id: menuId },
|
|
46
|
-
user,
|
|
47
|
-
template,
|
|
48
|
-
creator: user,
|
|
49
|
-
updater: user
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Directive('@transaction')
|
|
54
|
-
@Mutation(returns => GridPersonalize, { description: 'To modify Gridpersonalize information' })
|
|
55
|
-
async updateGridPersonalize(
|
|
56
|
-
@Arg('id') id: string,
|
|
57
|
-
@Arg('patch') patch: GridPersonalizePatch,
|
|
58
|
-
@Ctx() context: any
|
|
59
|
-
): Promise<GridPersonalize> {
|
|
60
|
-
const { domain, user, tx } = context.state
|
|
61
|
-
|
|
62
|
-
const repository = tx.getRepository(GridPersonalize)
|
|
63
|
-
const gridpersonalize = await repository.findOne({ where: { domain, id } })
|
|
64
|
-
|
|
65
|
-
return await repository.save({
|
|
66
|
-
...gridpersonalize,
|
|
67
|
-
...patch,
|
|
68
|
-
updater: user
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@Directive('@transaction')
|
|
73
|
-
@Mutation(returns => [GridPersonalize], { description: "To modify multiple Gridpersonalizes' information" })
|
|
74
|
-
async updateMultipleGridpersonalize(
|
|
75
|
-
@Arg('patches', type => [GridPersonalizePatch]) patches: GridPersonalizePatch[],
|
|
76
|
-
@Ctx() context: any
|
|
77
|
-
): Promise<GridPersonalize[]> {
|
|
78
|
-
const { domain, user, tx } = context.state
|
|
79
|
-
|
|
80
|
-
let results = []
|
|
81
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
82
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
83
|
-
const gridpersonalizeRepo = tx.getRepository(GridPersonalize)
|
|
84
|
-
|
|
85
|
-
if (_createRecords.length > 0) {
|
|
86
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
87
|
-
const newRecord = _createRecords[i]
|
|
88
|
-
|
|
89
|
-
const result = await gridpersonalizeRepo.save({
|
|
90
|
-
...newRecord,
|
|
91
|
-
user,
|
|
92
|
-
domain,
|
|
93
|
-
creator: user,
|
|
94
|
-
updater: user
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
results.push({ ...result, cuFlag: '+' })
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (_updateRecords.length > 0) {
|
|
102
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
103
|
-
const updRecord = _updateRecords[i]
|
|
104
|
-
const gridpersonalize = await gridpersonalizeRepo.findOne({
|
|
105
|
-
where: { domain: { id: domain.id }, id: updRecord.id }
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
const result = await gridpersonalizeRepo.save({
|
|
109
|
-
...gridpersonalize,
|
|
110
|
-
...updRecord,
|
|
111
|
-
updater: user
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return results
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@Directive('@transaction')
|
|
122
|
-
@Mutation(returns => Boolean, { description: 'To delete Gridpersonalize' })
|
|
123
|
-
async deleteGridPersonalize(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
|
124
|
-
const { domain, tx } = context.state
|
|
125
|
-
|
|
126
|
-
await tx.getRepository(GridPersonalize).delete({ domain, id })
|
|
127
|
-
return true
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
@Directive('@transaction')
|
|
131
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple gridpersonalizes' })
|
|
132
|
-
async deleteGridPersonalizes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
|
133
|
-
const { domain, tx } = context.state
|
|
134
|
-
|
|
135
|
-
await tx.getRepository(GridPersonalize).delete({
|
|
136
|
-
domain,
|
|
137
|
-
id: In(ids)
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
return true
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { Domain, ListParam, convertListParams, getRepository } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { Menu } from '@things-factory/menu-base'
|
|
5
|
-
import { GridPersonalize } from './grid-personalize'
|
|
6
|
-
import { GridPersonalizeList } from './grid-personalize-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(GridPersonalize)
|
|
9
|
-
export class GridPersonalizeQuery {
|
|
10
|
-
@Query(returns => GridPersonalize, { nullable: true, description: `To fetch a Gridpersonalize` })
|
|
11
|
-
async gridPersonalize(@Arg('id') id: string, @Ctx() context: any): Promise<GridPersonalize | null> {
|
|
12
|
-
const { domain } = context.state
|
|
13
|
-
return await getRepository(GridPersonalize).findOne({
|
|
14
|
-
where: { domain: { id: domain.id }, id }
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@Query(returns => GridPersonalize, { nullable: true, description: `To fetch a User's own Gridpersonalize` })
|
|
19
|
-
async myGridPersonalize(@Arg('menuId') menuId: string, @Ctx() context: any): Promise<GridPersonalize | null> {
|
|
20
|
-
const { domain, user } = context.state
|
|
21
|
-
return await getRepository(GridPersonalize).findOne({
|
|
22
|
-
where: { domain: { id: domain.id }, menu: { id: menuId }, user: { id: user.id } }
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Query(returns => GridPersonalizeList, { description: 'To fetch multiple Gridpersonalizes' })
|
|
27
|
-
async gridPersonalizes(@Args() params: ListParam, @Ctx() context: any): Promise<GridPersonalizeList> {
|
|
28
|
-
const { domain } = context.state
|
|
29
|
-
|
|
30
|
-
const convertedParams = convertListParams(params, domain.id)
|
|
31
|
-
const [items, total] = await getRepository(GridPersonalize).findAndCount(convertedParams)
|
|
32
|
-
|
|
33
|
-
return { items, total }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@FieldResolver(type => Menu)
|
|
37
|
-
async menu(@Root() gridPersonalize: GridPersonalize): Promise<Menu> {
|
|
38
|
-
return await getRepository(Menu).findOneBy({ id: gridPersonalize.menuId })
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@FieldResolver(type => User)
|
|
42
|
-
async user(@Root() gridPersonalize: GridPersonalize): Promise<User> {
|
|
43
|
-
return await getRepository(User).findOneBy({ id: gridPersonalize.userId })
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@FieldResolver(type => Domain)
|
|
47
|
-
async domain(@Root() gridPersonalize: GridPersonalize): Promise<Domain> {
|
|
48
|
-
return await getRepository(Domain).findOneBy({ id: gridPersonalize.domainId })
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@FieldResolver(type => User)
|
|
52
|
-
async updater(@Root() gridPersonalize: GridPersonalize): Promise<User> {
|
|
53
|
-
return await getRepository(User).findOneBy({ id: gridPersonalize.updaterId })
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@FieldResolver(type => User)
|
|
57
|
-
async creator(@Root() gridPersonalize: GridPersonalize): Promise<User> {
|
|
58
|
-
return await getRepository(User).findOneBy({ id: gridPersonalize.creatorId })
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'
|
|
2
|
-
import { ObjectRef, ScalarObject } from '@things-factory/shell'
|
|
3
|
-
|
|
4
|
-
import { GridPersonalize } from './grid-personalize'
|
|
5
|
-
|
|
6
|
-
@InputType()
|
|
7
|
-
export class NewGridPersonalize {
|
|
8
|
-
@Field(type => ObjectRef)
|
|
9
|
-
user: ObjectRef
|
|
10
|
-
|
|
11
|
-
@Field(type => ObjectRef)
|
|
12
|
-
menu: ObjectRef
|
|
13
|
-
|
|
14
|
-
@Field(type => ScalarObject, { nullable: false })
|
|
15
|
-
template: { [key: string]: string[] }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@InputType()
|
|
19
|
-
export class GridPersonalizePatch {
|
|
20
|
-
@Field(type => ID, { nullable: true })
|
|
21
|
-
id?: string
|
|
22
|
-
|
|
23
|
-
@Field(type => ObjectRef, { nullable: true })
|
|
24
|
-
user?: ObjectRef
|
|
25
|
-
|
|
26
|
-
@Field(type => ObjectRef, { nullable: true })
|
|
27
|
-
menu?: ObjectRef
|
|
28
|
-
|
|
29
|
-
@Field(type => ScalarObject, { nullable: true })
|
|
30
|
-
template?: { [key: string]: string[] }
|
|
31
|
-
|
|
32
|
-
@Field()
|
|
33
|
-
cuFlag: string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@ObjectType()
|
|
37
|
-
export class GridPersonalizeList {
|
|
38
|
-
@Field(type => [GridPersonalize])
|
|
39
|
-
items: GridPersonalize[]
|
|
40
|
-
|
|
41
|
-
@Field(type => Int)
|
|
42
|
-
total: number
|
|
43
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateDateColumn,
|
|
3
|
-
UpdateDateColumn,
|
|
4
|
-
Entity,
|
|
5
|
-
Index,
|
|
6
|
-
Column,
|
|
7
|
-
RelationId,
|
|
8
|
-
ManyToOne,
|
|
9
|
-
OneToMany,
|
|
10
|
-
PrimaryGeneratedColumn
|
|
11
|
-
} from 'typeorm'
|
|
12
|
-
import { ObjectType, Field, Int, ID, Float, registerEnumType } from 'type-graphql'
|
|
13
|
-
|
|
14
|
-
import { Domain, ScalarObject } from '@things-factory/shell'
|
|
15
|
-
import { User } from '@things-factory/auth-base'
|
|
16
|
-
import { Menu } from '@things-factory/menu-base'
|
|
17
|
-
|
|
18
|
-
@Entity('grid_personalize')
|
|
19
|
-
@Index(
|
|
20
|
-
'ix_gridpersonalize_0',
|
|
21
|
-
(gridPersonalize: GridPersonalize) => [gridPersonalize.domain, gridPersonalize.user, gridPersonalize.menu],
|
|
22
|
-
{ unique: true }
|
|
23
|
-
)
|
|
24
|
-
@ObjectType({ description: 'Entity for GridPersonalize' })
|
|
25
|
-
export class GridPersonalize {
|
|
26
|
-
@PrimaryGeneratedColumn('uuid')
|
|
27
|
-
@Field(type => ID)
|
|
28
|
-
readonly id: string
|
|
29
|
-
|
|
30
|
-
@ManyToOne(type => Domain)
|
|
31
|
-
@Field({ nullable: false })
|
|
32
|
-
domain: Domain
|
|
33
|
-
|
|
34
|
-
@RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.domain)
|
|
35
|
-
domainId: string
|
|
36
|
-
|
|
37
|
-
@ManyToOne(type => User)
|
|
38
|
-
@Field({ nullable: false })
|
|
39
|
-
user: User
|
|
40
|
-
|
|
41
|
-
@RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.user)
|
|
42
|
-
userId: string
|
|
43
|
-
|
|
44
|
-
@ManyToOne(type => Menu, { createForeignKeyConstraints: false })
|
|
45
|
-
@Field({ nullable: false })
|
|
46
|
-
menu: Menu
|
|
47
|
-
|
|
48
|
-
@RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.menu)
|
|
49
|
-
menuId: string
|
|
50
|
-
|
|
51
|
-
@Column('simple-json', { nullable: true })
|
|
52
|
-
@Field(type => ScalarObject, { nullable: true })
|
|
53
|
-
template?: { [key: string]: string[] }
|
|
54
|
-
|
|
55
|
-
@CreateDateColumn()
|
|
56
|
-
@Field({ nullable: true })
|
|
57
|
-
createdAt?: Date
|
|
58
|
-
|
|
59
|
-
@UpdateDateColumn()
|
|
60
|
-
@Field({ nullable: true })
|
|
61
|
-
updatedAt?: Date
|
|
62
|
-
|
|
63
|
-
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
64
|
-
@Field({ nullable: true })
|
|
65
|
-
creator?: User
|
|
66
|
-
|
|
67
|
-
@RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.creator)
|
|
68
|
-
creatorId?: string
|
|
69
|
-
|
|
70
|
-
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
71
|
-
@Field({ nullable: true })
|
|
72
|
-
updater?: User
|
|
73
|
-
|
|
74
|
-
@RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.updater)
|
|
75
|
-
updaterId?: string
|
|
76
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { GridPersonalize } from './grid-personalize'
|
|
3
|
-
import { GridPersonalizeQuery } from './grid-personalize-query'
|
|
4
|
-
import { GridPersonalizeMutation } from './grid-personalize-mutation'
|
|
5
|
-
|
|
6
|
-
export const entities = [GridPersonalize]
|
|
7
|
-
export const resolvers = [GridPersonalizeQuery, GridPersonalizeMutation]
|