@things-factory/meta-ui 8.0.40 → 9.0.0-9.0.0-beta.59.0
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/dist-client/bootstrap.d.ts +5 -5
- package/dist-client/bootstrap.js +20 -20
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/service-util.d.ts +2 -2
- package/dist-client/utils/service-util.js +4 -4
- package/dist-client/utils/service-util.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/client/bootstrap.ts +0 -170
- package/client/component/filter/filter-form-meta-code-select.ts +0 -102
- package/client/component/filter/filter-form-meta-object-select.ts +0 -107
- package/client/component/filter/filter-grist-meta-code-select.ts +0 -97
- package/client/component/filter/filter-grist-meta-object-select.ts +0 -102
- package/client/component/grist/editor/grist-editor-code-input.js +0 -96
- package/client/component/grist/editor/grist-editor-meta-code-selector.js +0 -157
- package/client/component/grist/editor/grist-editor-meta-object-selector.js +0 -122
- package/client/component/grist/renderer/grist-renderer-code-input.js +0 -20
- package/client/component/grist/renderer/grist-renderer-meta-code-selector.js +0 -28
- package/client/component/grist/renderer/grist-renderer-meta-object-selector.js +0 -25
- package/client/component/popup/code-input-editor-popup.js +0 -111
- package/client/component/popup/file-upload-popup.js +0 -129
- package/client/component/popup/meta-object-selector-popup.ts +0 -356
- package/client/component/popup/record-based-code-editor-popup.ts +0 -141
- package/client/dynamic-menus.ts +0 -38
- package/client/index.ts +0 -18
- package/client/load-components.ts +0 -17
- package/client/mixin/meta-base-mixin.js +0 -323
- package/client/mixin/meta-basic-grist-mixin.js +0 -283
- package/client/mixin/meta-button-mixin.js +0 -116
- package/client/mixin/meta-form-mixin.js +0 -435
- package/client/mixin/meta-grist-tab-mixin.js +0 -335
- package/client/mixin/meta-main-tab-mixin.js +0 -267
- package/client/mixin/meta-master-detail-mixin.js +0 -395
- package/client/mixin/meta-service-mixin.js +0 -306
- package/client/mixin/meta-tab-detail-mixin.js +0 -283
- package/client/mixin/meta-tab-mixin.js +0 -190
- package/client/pages/activity/meta-activity-define-page.js +0 -422
- package/client/pages/activity/meta-activity-list-page.js +0 -262
- package/client/pages/activity/meta-activity-viewer-element.js +0 -35
- package/client/pages/activity/meta-activity-writer-element.js +0 -48
- package/client/pages/activity/meta-activiy-mixin.js +0 -79
- package/client/pages/button-role/button-role-detail.js +0 -50
- package/client/pages/button-role/button-role-page.js +0 -25
- package/client/pages/doc-number/doc-number-page.js +0 -24
- package/client/pages/doc-number/next-doc-number-popup.js +0 -25
- package/client/pages/entity/config-entity.js +0 -955
- package/client/pages/entity/main-menu-selector.js +0 -245
- package/client/pages/history/history-copy-list-popup.js +0 -145
- package/client/pages/history/history-json-list-popup.js +0 -159
- package/client/pages/menu/dynamic-menu-template.js +0 -92
- package/client/pages/menu/dynamic-menu.ts +0 -744
- package/client/pages/menu/export-menu-popup.js +0 -468
- package/client/pages/meta-form-element.js +0 -9
- package/client/pages/meta-grist-element.js +0 -12
- package/client/pages/meta-grist-page.js +0 -16
- package/client/pages/meta-grist-tab-element.js +0 -16
- package/client/pages/meta-grist-tab-page.js +0 -16
- package/client/pages/meta-main-tab-element.js +0 -12
- package/client/pages/meta-main-tab-page.js +0 -16
- package/client/pages/meta-master-detail-element.js +0 -12
- package/client/pages/meta-master-detail-page.js +0 -16
- package/client/pages/meta-tab-detail-element.js +0 -12
- package/client/pages/meta-tab-detail-page.js +0 -16
- package/client/pages/meta-tab-element.js +0 -15
- package/client/pages/printer-device/printer-device-page.js +0 -24
- package/client/pages/template/doc-template-page.js +0 -24
- package/client/pages/template/template-file-page.js +0 -24
- package/client/pages/terms/config-terminology.js +0 -214
- package/client/pages/work-code/work-code-detail-popup.js +0 -16
- package/client/pages/work-code/work-code-page.js +0 -23
- package/client/route.ts +0 -36
- package/client/tsconfig.json +0 -13
- package/client/utils/grist-default-value.js +0 -36
- package/client/utils/meta-api.js +0 -811
- package/client/utils/meta-crypto.js +0 -52
- package/client/utils/meta-ui-util.js +0 -3304
- package/client/utils/rest-service-util.js +0 -328
- package/client/utils/service-util.js +0 -1327
- package/client/utils/terms-util.ts +0 -119
- package/client/utils/ui-util.js +0 -338
- package/client/utils/value-util.js +0 -234
- package/server/activity/CommonActivity.ts +0 -68
- package/server/index.ts +0 -3
- package/server/routes.ts +0 -61
- package/server/service/button-role/button-role-mutation.ts +0 -105
- package/server/service/button-role/button-role-query.ts +0 -53
- package/server/service/button-role/button-role-type.ts +0 -39
- package/server/service/button-role/button-role.ts +0 -61
- package/server/service/button-role/index.ts +0 -7
- package/server/service/dynamic-menu/dynamic-menu-query.ts +0 -270
- package/server/service/dynamic-menu/dynamic-menu-type.ts +0 -74
- package/server/service/dynamic-menu/index.ts +0 -3
- package/server/service/entity-event-subscriber/entity-event-subscriber.ts +0 -80
- package/server/service/entity-event-subscriber/index.ts +0 -3
- package/server/service/index.ts +0 -41
- package/server/service/menu-button-auth/index.ts +0 -7
- package/server/service/menu-button-auth/menu-button-auth-mutation.ts +0 -133
- package/server/service/menu-button-auth/menu-button-auth-query.ts +0 -138
- package/server/service/menu-button-auth/menu-button-auth-type.ts +0 -63
- package/server/service/menu-button-auth/menu-button-auth.ts +0 -92
- package/server/service/meta-activity/index.ts +0 -5
- package/server/service/meta-activity/meta-activity-mutation.ts +0 -191
- package/server/service/meta-activity/meta-activity-query.ts +0 -43
- package/server/service/meta-activity/meta-activity-type.ts +0 -56
- package/server/service/set-translations/index.ts +0 -3
- package/server/service/set-translations/set-translation-resolver.ts +0 -63
- package/server/service/work-code/index.ts +0 -6
- package/server/service/work-code/work-code-mutation.ts +0 -147
- package/server/service/work-code/work-code-query.ts +0 -67
- package/server/service/work-code/work-code-type.ts +0 -60
- package/server/service/work-code/work-code.ts +0 -83
- package/server/service/work-code-detail/index.ts +0 -6
- package/server/service/work-code-detail/work-code-detail-mutation.ts +0 -149
- package/server/service/work-code-detail/work-code-detail-query.ts +0 -59
- package/server/service/work-code-detail/work-code-detail-type.ts +0 -50
- package/server/service/work-code-detail/work-code-detail.ts +0 -82
- package/server/tsconfig.json +0 -9
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { Menu } from '@things-factory/menu-base'
|
|
4
|
-
import { Entity, EntityColumn } from '@things-factory/resource-base'
|
|
5
|
-
import { Terminology } from '@things-factory/i18n-base'
|
|
6
|
-
|
|
7
|
-
@ObjectType()
|
|
8
|
-
export class DynamicMenuList {
|
|
9
|
-
@Field(type => [Menu])
|
|
10
|
-
items: Menu[]
|
|
11
|
-
|
|
12
|
-
@Field(type => Int)
|
|
13
|
-
total: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@ObjectType()
|
|
17
|
-
export class DBIndex {
|
|
18
|
-
@Field(type => String)
|
|
19
|
-
name: string
|
|
20
|
-
|
|
21
|
-
@Field(type => Boolean)
|
|
22
|
-
isUnique: boolean
|
|
23
|
-
|
|
24
|
-
@Field(type => [String], { nullable: true })
|
|
25
|
-
columns?: string[]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@ObjectType()
|
|
29
|
-
export class DBColumn {
|
|
30
|
-
@Field(type => String)
|
|
31
|
-
name: string
|
|
32
|
-
|
|
33
|
-
@Field(type => Boolean)
|
|
34
|
-
isNullable: boolean
|
|
35
|
-
|
|
36
|
-
@Field(type => String)
|
|
37
|
-
length: string
|
|
38
|
-
|
|
39
|
-
@Field(type => String)
|
|
40
|
-
type: string
|
|
41
|
-
|
|
42
|
-
@Field(type => String || Number || Boolean, { nullable: true })
|
|
43
|
-
default?: any
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@ObjectType()
|
|
47
|
-
export class ExportMenuInfo {
|
|
48
|
-
@Field(type => String)
|
|
49
|
-
id: string
|
|
50
|
-
|
|
51
|
-
@Field(type => Menu, { nullable: true })
|
|
52
|
-
menu?: Menu
|
|
53
|
-
|
|
54
|
-
@Field(type => Menu, { nullable: true })
|
|
55
|
-
parentMenu?: Menu
|
|
56
|
-
|
|
57
|
-
@Field(type => Entity, { nullable: true })
|
|
58
|
-
entity?: Entity
|
|
59
|
-
|
|
60
|
-
@Field(type => [EntityColumn], { nullable: true })
|
|
61
|
-
entityColumns?: EntityColumn[]
|
|
62
|
-
|
|
63
|
-
@Field(type => [Terminology], { nullable: true })
|
|
64
|
-
termsLabel?: Terminology[]
|
|
65
|
-
|
|
66
|
-
@Field(type => [Terminology], { nullable: true })
|
|
67
|
-
termsTitle?: Terminology[]
|
|
68
|
-
|
|
69
|
-
@Field(type => [DBIndex], { nullable: true })
|
|
70
|
-
indices?: DBIndex[]
|
|
71
|
-
|
|
72
|
-
@Field(type => [DBColumn], { nullable: true })
|
|
73
|
-
columns?: DBColumn[]
|
|
74
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { EventSubscriber, InsertEvent, UpdateEvent, EntitySubscriberInterface } from 'typeorm'
|
|
2
|
-
import { getRepository } from '@things-factory/shell'
|
|
3
|
-
import { Entity, EntityColumn } from '@things-factory/resource-base'
|
|
4
|
-
import { generateId } from '@things-factory/id-rule-base'
|
|
5
|
-
const { camelCase } = require('lodash')
|
|
6
|
-
import moment from 'moment-timezone'
|
|
7
|
-
|
|
8
|
-
import gql from 'graphql-tag'
|
|
9
|
-
|
|
10
|
-
@EventSubscriber()
|
|
11
|
-
export class EntityEventSubscriber implements EntitySubscriberInterface<any> {
|
|
12
|
-
async beforeInsert(event: InsertEvent<any>): Promise<any> {
|
|
13
|
-
let data = event.entity
|
|
14
|
-
|
|
15
|
-
if (!data) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let entityName = event.metadata.name
|
|
20
|
-
let domainId = undefined
|
|
21
|
-
|
|
22
|
-
if (data.domainId) {
|
|
23
|
-
domainId = data.domainId
|
|
24
|
-
} else if (data.domain) {
|
|
25
|
-
domainId = data.domain.id
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!domainId) {
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let generateColumns = await this.findEntityColumns(domainId, entityName)
|
|
33
|
-
|
|
34
|
-
if (generateColumns && generateColumns.length > 0) {
|
|
35
|
-
for (let idx = 0; idx < generateColumns.length; idx++) {
|
|
36
|
-
let col = generateColumns[idx]
|
|
37
|
-
let colName = camelCase(col.name)
|
|
38
|
-
|
|
39
|
-
if (event.entity[colName]) {
|
|
40
|
-
continue
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let seed = {
|
|
44
|
-
date: moment().format('YYYY-MM-DD'),
|
|
45
|
-
month: moment().format('YYYY-MM'),
|
|
46
|
-
year: moment().format('YYYY')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let genInfo = col.defVal.split(',')
|
|
50
|
-
|
|
51
|
-
for (let mapIdx = 1; mapIdx < genInfo.length; mapIdx++) {
|
|
52
|
-
let nameValue = genInfo[mapIdx].split(':')
|
|
53
|
-
let name: string = nameValue[0]
|
|
54
|
-
let value: string = nameValue[1]
|
|
55
|
-
|
|
56
|
-
seed[name] = value.indexOf('$') > -1 ? value.substring(1) : event.entity[value]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
event.entity[colName] = await generateId({
|
|
60
|
-
domain: { id: domainId },
|
|
61
|
-
type: genInfo[0],
|
|
62
|
-
seed
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async findEntityColumns(domainId: string, entityName: string): Promise<EntityColumn[]> {
|
|
69
|
-
let entity: Entity = await getRepository(Entity).findOne({
|
|
70
|
-
where: { domain: { id: domainId }, name: entityName },
|
|
71
|
-
relations: ['columns']
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
if (!entity) {
|
|
75
|
-
return undefined
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return (entity.columns || []).filter(x => x.defVal)
|
|
79
|
-
}
|
|
80
|
-
}
|
package/server/service/index.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* EXPORT ENTITY TYPES */
|
|
2
|
-
export * from './button-role/button-role'
|
|
3
|
-
export * from './menu-button-auth/menu-button-auth'
|
|
4
|
-
export * from './work-code-detail/work-code-detail'
|
|
5
|
-
export * from './work-code/work-code'
|
|
6
|
-
|
|
7
|
-
/* IMPORT ENTITIES AND RESOLVERS */
|
|
8
|
-
import { entities as ButtonRoleEntities, resolvers as ButtonRoleResolvers } from './button-role'
|
|
9
|
-
import { entities as MenuButtonAuthEntities, resolvers as MenuButtonAuthResolvers } from './menu-button-auth'
|
|
10
|
-
import { resolvers as SetTranslationResolvers } from './set-translations'
|
|
11
|
-
import { resolvers as MetaActivityResolvers } from './meta-activity'
|
|
12
|
-
import { entities as WorkCodeDetailEntities, resolvers as WorkCodeDetailResolvers } from './work-code-detail'
|
|
13
|
-
import { entities as WorkCodeEntities, resolvers as WorkCodeResolvers } from './work-code'
|
|
14
|
-
import { resolvers as DynamicMenuResolvers } from './dynamic-menu'
|
|
15
|
-
import { subscribers as EntityEventSubscriber } from './entity-event-subscriber'
|
|
16
|
-
|
|
17
|
-
export const entities = [
|
|
18
|
-
/* ENTITIES */
|
|
19
|
-
...ButtonRoleEntities,
|
|
20
|
-
...MenuButtonAuthEntities,
|
|
21
|
-
...WorkCodeDetailEntities,
|
|
22
|
-
...WorkCodeEntities
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
export const schema = {
|
|
26
|
-
resolverClasses: [
|
|
27
|
-
/* RESOLVER CLASSES */
|
|
28
|
-
...ButtonRoleResolvers,
|
|
29
|
-
...MenuButtonAuthResolvers,
|
|
30
|
-
...SetTranslationResolvers,
|
|
31
|
-
...MetaActivityResolvers,
|
|
32
|
-
...WorkCodeDetailResolvers,
|
|
33
|
-
...WorkCodeResolvers,
|
|
34
|
-
...DynamicMenuResolvers
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const subscribers = [
|
|
39
|
-
/* SUBSCRIBERS */
|
|
40
|
-
...EntityEventSubscriber
|
|
41
|
-
]
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { MenuButtonAuth } from './menu-button-auth'
|
|
3
|
-
import { MenuButtonAuthQuery } from './menu-button-auth-query'
|
|
4
|
-
import { MenuButtonAuthMutation } from './menu-button-auth-mutation'
|
|
5
|
-
|
|
6
|
-
export const entities = [MenuButtonAuth]
|
|
7
|
-
export const resolvers = [MenuButtonAuthQuery, MenuButtonAuthMutation]
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
3
|
-
import { In } from 'typeorm'
|
|
4
|
-
import { MenuButtonAuth } from './menu-button-auth'
|
|
5
|
-
import { NewMenuButtonAuth, MenuButtonAuthPatch } from './menu-button-auth-type'
|
|
6
|
-
import { Domain, getRepository, ScalarObject } from '@things-factory/shell'
|
|
7
|
-
import { User } from '@things-factory/auth-base'
|
|
8
|
-
|
|
9
|
-
@Resolver(MenuButtonAuth)
|
|
10
|
-
export class MenuButtonAuthMutation {
|
|
11
|
-
@Directive('@transaction')
|
|
12
|
-
@Mutation(returns => MenuButtonAuth, { description: 'To create new MenuButtonAuth' })
|
|
13
|
-
async createMenuButtonAuth(@Arg('menuButtonAuth') menuButtonAuth: NewMenuButtonAuth, @Ctx() context: any): Promise<MenuButtonAuth> {
|
|
14
|
-
const { domain, user, tx } = context.state
|
|
15
|
-
|
|
16
|
-
return await tx.getRepository(MenuButtonAuth).save({
|
|
17
|
-
...menuButtonAuth,
|
|
18
|
-
domain,
|
|
19
|
-
creator: user,
|
|
20
|
-
updater: user
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Directive('@transaction')
|
|
25
|
-
@Mutation(returns => MenuButtonAuth, { description: 'To modify MenuButtonAuth information' })
|
|
26
|
-
async updateMenuButtonAuth(
|
|
27
|
-
@Arg('id') id: string,
|
|
28
|
-
@Arg('patch') patch: MenuButtonAuthPatch,
|
|
29
|
-
@Ctx() context: any
|
|
30
|
-
): Promise<MenuButtonAuth> {
|
|
31
|
-
const { domain, user, tx } = context.state
|
|
32
|
-
|
|
33
|
-
const repository = tx.getRepository(MenuButtonAuth)
|
|
34
|
-
const menuButtonAuth = await repository.findOne(
|
|
35
|
-
{
|
|
36
|
-
where: { domain: { id: domain.id }, id },
|
|
37
|
-
relations: ['domain','updater','creator']
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
return await repository.save({
|
|
42
|
-
...menuButtonAuth,
|
|
43
|
-
...patch,
|
|
44
|
-
updater: user
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@Directive('@transaction')
|
|
49
|
-
@Mutation(returns => [MenuButtonAuth], { description: "To modify multiple MenuButtonAuths' information" })
|
|
50
|
-
async updateMultipleMenuButtonAuth(
|
|
51
|
-
@Arg('patches', type => [MenuButtonAuthPatch]) patches: MenuButtonAuthPatch[],
|
|
52
|
-
@Ctx() context: any
|
|
53
|
-
): Promise<MenuButtonAuth[]> {
|
|
54
|
-
const { domain, user, tx } = context.state
|
|
55
|
-
|
|
56
|
-
let results = []
|
|
57
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
58
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
59
|
-
const menuButtonAuthRepo = tx.getRepository(MenuButtonAuth)
|
|
60
|
-
|
|
61
|
-
if (_createRecords.length > 0) {
|
|
62
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
|
63
|
-
const newRecord = _createRecords[i]
|
|
64
|
-
|
|
65
|
-
const result = await menuButtonAuthRepo.save({
|
|
66
|
-
...newRecord,
|
|
67
|
-
domain,
|
|
68
|
-
creator: user,
|
|
69
|
-
updater: user
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
results.push({ ...result, cuFlag: '+' })
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (_updateRecords.length > 0) {
|
|
77
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
|
78
|
-
const updRecord = _updateRecords[i]
|
|
79
|
-
const menuButtonAuth = await menuButtonAuthRepo.findOne({
|
|
80
|
-
where: { domain: { id: domain.id }, id:updRecord.id },
|
|
81
|
-
relations: ['domain','updater','creator']
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
const result = await menuButtonAuthRepo.save({
|
|
85
|
-
...menuButtonAuth,
|
|
86
|
-
...updRecord,
|
|
87
|
-
updater: user
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
results.push({ ...result, cuFlag: 'M' })
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return results
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
@Directive('@transaction')
|
|
98
|
-
@Mutation(returns => [MenuButtonAuth], { description: "To modify multiple MenuButtonAuths' information" })
|
|
99
|
-
async updateMultipleMenuButtonAuths(
|
|
100
|
-
@Arg('patches', type => ScalarObject ) patches: any,
|
|
101
|
-
@Ctx() context: any
|
|
102
|
-
): Promise<MenuButtonAuth[]> {
|
|
103
|
-
const { domain, user, tx } = context.state
|
|
104
|
-
|
|
105
|
-
console.log(patches)
|
|
106
|
-
return []
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@Directive('@transaction')
|
|
110
|
-
@Mutation(returns => Boolean, { description: 'To delete MenuButtonAuth' })
|
|
111
|
-
async deleteMenuButtonAuth(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
|
112
|
-
const { domain, tx, user } = context.state
|
|
113
|
-
await tx.getRepository(MenuButtonAuth).remove({ domain, id, updater:user })
|
|
114
|
-
return true
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@Directive('@transaction')
|
|
118
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple MenuButtonAuths' })
|
|
119
|
-
async deleteMenuButtonAuths(
|
|
120
|
-
@Arg('ids', type => [String]) ids: string[],
|
|
121
|
-
@Ctx() context: any
|
|
122
|
-
): Promise<boolean> {
|
|
123
|
-
const { domain, tx, user } = context.state
|
|
124
|
-
|
|
125
|
-
let delEntitis = ids.map(id=>{
|
|
126
|
-
return {domain,id,updater:user}
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
await tx.getRepository(MenuButtonAuth).remove(delEntitis)
|
|
130
|
-
|
|
131
|
-
return true
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { IsNull, Not } from 'typeorm'
|
|
3
|
-
import {
|
|
4
|
-
Domain,
|
|
5
|
-
ListParam,
|
|
6
|
-
convertListParams,
|
|
7
|
-
getRepository,
|
|
8
|
-
getQueryBuilderFromListParams
|
|
9
|
-
} from '@things-factory/shell'
|
|
10
|
-
import { User } from '@things-factory/auth-base'
|
|
11
|
-
import { MenuButtonAuth } from './menu-button-auth'
|
|
12
|
-
import { MenuButtonAuthList } from './menu-button-auth-type'
|
|
13
|
-
import { Menu } from '@things-factory/menu-base'
|
|
14
|
-
import { ButtonRole } from './../button-role/button-role'
|
|
15
|
-
|
|
16
|
-
@Resolver(MenuButtonAuth)
|
|
17
|
-
export class MenuButtonAuthQuery {
|
|
18
|
-
@Query(returns => MenuButtonAuth, { description: 'To fetch a MenuButtonAuth' })
|
|
19
|
-
async menuButtonAuth(@Arg('id') id: string, @Ctx() context: any): Promise<MenuButtonAuth> {
|
|
20
|
-
const { domain } = context.state
|
|
21
|
-
return await getRepository(MenuButtonAuth).findOne({
|
|
22
|
-
where: { domain: { id: domain.id }, id }
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Query(returns => MenuButtonAuthList, { description: 'To fetch a multiple MenuButtonAuth' })
|
|
27
|
-
async menuButtonAuths(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<MenuButtonAuthList> {
|
|
28
|
-
const { domain } = context.state
|
|
29
|
-
|
|
30
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
31
|
-
domain,
|
|
32
|
-
params,
|
|
33
|
-
repository: await getRepository(MenuButtonAuth)
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
37
|
-
|
|
38
|
-
return { items, total }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Query(returns => MenuButtonAuthList, { description: 'To fetch a multiple RoleMenuButtonAuth' })
|
|
42
|
-
async roleMenuButtonAuths(
|
|
43
|
-
@Args(type => ListParam) params: ListParam,
|
|
44
|
-
@Ctx() context: any
|
|
45
|
-
): Promise<MenuButtonAuthList> {
|
|
46
|
-
const { domain } = context.state
|
|
47
|
-
const roleId = params.filters.find(x => x.name == 'roleId').value
|
|
48
|
-
const parentMenuId = params.filters.some(x => x.name == 'menuId')
|
|
49
|
-
? params.filters.find(x => x.name == 'menuId').value
|
|
50
|
-
: undefined
|
|
51
|
-
|
|
52
|
-
// 기존 role 권한 조회
|
|
53
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
54
|
-
domain,
|
|
55
|
-
params,
|
|
56
|
-
repository: await getRepository(MenuButtonAuth)
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
60
|
-
|
|
61
|
-
// 메뉴 리스트 조회
|
|
62
|
-
let menuParams = {
|
|
63
|
-
where: {
|
|
64
|
-
domain: {
|
|
65
|
-
id: domain.id
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
order: { rank: 'ASC' }
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (parentMenuId) {
|
|
72
|
-
menuParams.where['parent'] = {
|
|
73
|
-
id: parentMenuId
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
menuParams.where['parent'] = Not(IsNull())
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const menus: Menu[] = await getRepository(Menu).find(menuParams as any)
|
|
80
|
-
|
|
81
|
-
let results: MenuButtonAuth[] = []
|
|
82
|
-
|
|
83
|
-
menus.forEach(menu => {
|
|
84
|
-
let menuRole = {
|
|
85
|
-
id: menu.id,
|
|
86
|
-
menu: menu,
|
|
87
|
-
menuId: menu.id,
|
|
88
|
-
roleId: roleId,
|
|
89
|
-
role: { id: roleId, name: '', description: '', domain: domain, domainId: domain.id },
|
|
90
|
-
domain: domain,
|
|
91
|
-
domainId: domain.id,
|
|
92
|
-
selectAuth: false,
|
|
93
|
-
createAuth: false,
|
|
94
|
-
updateAuth: false,
|
|
95
|
-
deleteAuth: false
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (items.some(x => x.menuId == menu.id)) {
|
|
99
|
-
let menuAuth = items.find(x => x.menuId == menu.id)
|
|
100
|
-
|
|
101
|
-
menuRole.id = menuAuth.id
|
|
102
|
-
menuRole.selectAuth = menuAuth.selectAuth
|
|
103
|
-
menuRole.updateAuth = menuAuth.updateAuth
|
|
104
|
-
menuRole.createAuth = menuAuth.createAuth
|
|
105
|
-
menuRole.deleteAuth = menuAuth.deleteAuth
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
results.push(menuRole)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
return { items: results, total: 0 }
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@FieldResolver(type => ButtonRole)
|
|
115
|
-
async role(@Root() menuButtonAuth: MenuButtonAuth): Promise<ButtonRole> {
|
|
116
|
-
return await getRepository(ButtonRole).findOneBy({ id: menuButtonAuth.roleId })
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@FieldResolver(type => Menu)
|
|
120
|
-
async menu(@Root() menuButtonAuth: MenuButtonAuth): Promise<Menu> {
|
|
121
|
-
return await getRepository(Menu).findOneBy({ id: menuButtonAuth.menuId })
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@FieldResolver(type => Domain)
|
|
125
|
-
async domain(@Root() menuButtonAuth: MenuButtonAuth): Promise<Domain> {
|
|
126
|
-
return await getRepository(Domain).findOneBy({ id: menuButtonAuth.domainId })
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@FieldResolver(type => User)
|
|
130
|
-
async updater(@Root() menuButtonAuth: MenuButtonAuth): Promise<User> {
|
|
131
|
-
return await getRepository(User).findOneBy({ id: menuButtonAuth.updaterId })
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@FieldResolver(type => User)
|
|
135
|
-
async creator(@Root() menuButtonAuth: MenuButtonAuth): Promise<User> {
|
|
136
|
-
return await getRepository(User).findOneBy({ id: menuButtonAuth.creatorId })
|
|
137
|
-
}
|
|
138
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'
|
|
3
|
-
import { ObjectRef } from '@things-factory/shell'
|
|
4
|
-
|
|
5
|
-
import { MenuButtonAuth } from './menu-button-auth'
|
|
6
|
-
|
|
7
|
-
@InputType()
|
|
8
|
-
export class NewMenuButtonAuth {
|
|
9
|
-
|
|
10
|
-
@Field(type => ObjectRef)
|
|
11
|
-
role: ObjectRef
|
|
12
|
-
|
|
13
|
-
@Field(type => ObjectRef)
|
|
14
|
-
menu: ObjectRef
|
|
15
|
-
|
|
16
|
-
@Field({ nullable: false })
|
|
17
|
-
selectAuth?: boolean
|
|
18
|
-
|
|
19
|
-
@Field({ nullable: true })
|
|
20
|
-
createAuth?: boolean
|
|
21
|
-
|
|
22
|
-
@Field({ nullable: true })
|
|
23
|
-
updateAuth?: boolean
|
|
24
|
-
|
|
25
|
-
@Field({ nullable: true })
|
|
26
|
-
deleteAuth?: boolean
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@InputType()
|
|
30
|
-
export class MenuButtonAuthPatch {
|
|
31
|
-
@Field(type => ID, { nullable: true })
|
|
32
|
-
id?: string
|
|
33
|
-
|
|
34
|
-
@Field(type => ObjectRef)
|
|
35
|
-
role: ObjectRef
|
|
36
|
-
|
|
37
|
-
@Field(type => ObjectRef)
|
|
38
|
-
menu: ObjectRef
|
|
39
|
-
|
|
40
|
-
@Field({ nullable: false })
|
|
41
|
-
selectAuth?: boolean
|
|
42
|
-
|
|
43
|
-
@Field({ nullable: true })
|
|
44
|
-
createAuth?: boolean
|
|
45
|
-
|
|
46
|
-
@Field({ nullable: true })
|
|
47
|
-
updateAuth?: boolean
|
|
48
|
-
|
|
49
|
-
@Field({ nullable: true })
|
|
50
|
-
deleteAuth?: boolean
|
|
51
|
-
|
|
52
|
-
@Field()
|
|
53
|
-
cuFlag: string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@ObjectType()
|
|
57
|
-
export class MenuButtonAuthList {
|
|
58
|
-
@Field(type => [MenuButtonAuth])
|
|
59
|
-
items: MenuButtonAuth[]
|
|
60
|
-
|
|
61
|
-
@Field(type => Int)
|
|
62
|
-
total: number
|
|
63
|
-
}
|
|
@@ -1,92 +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 } from '@things-factory/shell'
|
|
15
|
-
import { User } from '@things-factory/auth-base'
|
|
16
|
-
import { Menu } from '@things-factory/menu-base'
|
|
17
|
-
import { ButtonRole } from './../button-role/button-role'
|
|
18
|
-
|
|
19
|
-
@Entity('menu_button_auth')
|
|
20
|
-
@Index(
|
|
21
|
-
'ix_menu_button_auth_0',
|
|
22
|
-
(menuButtonAuth: MenuButtonAuth) => [menuButtonAuth.domain, menuButtonAuth.role, menuButtonAuth.menu],
|
|
23
|
-
{ unique: true }
|
|
24
|
-
)
|
|
25
|
-
@Index('ix_menu_button_auth_1', (menuButtonAuth: MenuButtonAuth) => [menuButtonAuth.domain, menuButtonAuth.role], {
|
|
26
|
-
unique: false
|
|
27
|
-
})
|
|
28
|
-
@ObjectType({ description: 'Entity for MenuButtonAuth' })
|
|
29
|
-
export class MenuButtonAuth {
|
|
30
|
-
@PrimaryGeneratedColumn('uuid')
|
|
31
|
-
@Field(type => ID)
|
|
32
|
-
readonly id: string
|
|
33
|
-
|
|
34
|
-
@ManyToOne(type => ButtonRole, { createForeignKeyConstraints: false, nullable: false })
|
|
35
|
-
@Field({ nullable: false })
|
|
36
|
-
role: ButtonRole
|
|
37
|
-
|
|
38
|
-
@RelationId((menuButtonAuth: MenuButtonAuth) => menuButtonAuth.role)
|
|
39
|
-
roleId: string
|
|
40
|
-
|
|
41
|
-
@ManyToOne(type => Menu, { createForeignKeyConstraints: false, nullable: false })
|
|
42
|
-
@Field({ nullable: false })
|
|
43
|
-
menu: Menu
|
|
44
|
-
|
|
45
|
-
@RelationId((menuButtonAuth: MenuButtonAuth) => menuButtonAuth.menu)
|
|
46
|
-
menuId: string
|
|
47
|
-
|
|
48
|
-
@Column({ name: 'select_auth', type: 'boolean', nullable: true, default: false })
|
|
49
|
-
@Field({ nullable: true })
|
|
50
|
-
selectAuth?: boolean
|
|
51
|
-
|
|
52
|
-
@Column({ name: 'create_auth', type: 'boolean', nullable: true, default: false })
|
|
53
|
-
@Field({ nullable: true })
|
|
54
|
-
createAuth?: boolean
|
|
55
|
-
|
|
56
|
-
@Column({ name: 'update_auth', type: 'boolean', nullable: true, default: false })
|
|
57
|
-
@Field({ nullable: true })
|
|
58
|
-
updateAuth?: boolean
|
|
59
|
-
|
|
60
|
-
@Column({ name: 'delete_auth', type: 'boolean', nullable: true, default: false })
|
|
61
|
-
@Field({ nullable: true })
|
|
62
|
-
deleteAuth?: boolean
|
|
63
|
-
|
|
64
|
-
@ManyToOne(type => Domain)
|
|
65
|
-
@Field(type => Domain, { nullable: false })
|
|
66
|
-
domain: Domain
|
|
67
|
-
|
|
68
|
-
@RelationId((menuButtonAuth: MenuButtonAuth) => menuButtonAuth.domain)
|
|
69
|
-
domainId: string
|
|
70
|
-
|
|
71
|
-
@CreateDateColumn()
|
|
72
|
-
@Field({ nullable: true })
|
|
73
|
-
createdAt?: Date
|
|
74
|
-
|
|
75
|
-
@UpdateDateColumn()
|
|
76
|
-
@Field({ nullable: true })
|
|
77
|
-
updatedAt?: Date
|
|
78
|
-
|
|
79
|
-
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
80
|
-
@Field(type => User, { nullable: true })
|
|
81
|
-
creator?: User
|
|
82
|
-
|
|
83
|
-
@RelationId((menuButtonAuth: MenuButtonAuth) => menuButtonAuth.creator)
|
|
84
|
-
creatorId?: string
|
|
85
|
-
|
|
86
|
-
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
87
|
-
@Field(type => User, { nullable: true })
|
|
88
|
-
updater?: User
|
|
89
|
-
|
|
90
|
-
@RelationId((menuButtonAuth: MenuButtonAuth) => menuButtonAuth.updater)
|
|
91
|
-
updaterId?: string
|
|
92
|
-
}
|