@things-factory/meta-ui 8.0.0-beta.9 → 8.0.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/client/bootstrap.ts +170 -0
- package/client/component/filter/filter-form-meta-code-select.ts +102 -0
- package/client/component/filter/filter-form-meta-object-select.ts +107 -0
- package/client/component/filter/filter-grist-meta-code-select.ts +97 -0
- package/client/component/filter/filter-grist-meta-object-select.ts +102 -0
- package/client/component/grist/editor/grist-editor-code-input.js +96 -0
- package/client/component/grist/editor/grist-editor-meta-code-selector.js +157 -0
- package/client/component/grist/editor/grist-editor-meta-object-selector.js +122 -0
- package/client/component/grist/renderer/grist-renderer-code-input.js +20 -0
- package/client/component/grist/renderer/grist-renderer-meta-code-selector.js +28 -0
- package/client/component/grist/renderer/grist-renderer-meta-object-selector.js +25 -0
- package/client/component/popup/code-input-editor-popup.js +111 -0
- package/client/component/popup/file-upload-popup.js +129 -0
- package/client/component/popup/meta-object-selector-popup.ts +356 -0
- package/client/component/popup/record-based-code-editor-popup.ts +141 -0
- package/client/dynamic-menus.ts +38 -0
- package/client/index.ts +18 -0
- package/client/load-components.ts +17 -0
- package/client/mixin/meta-base-mixin.js +323 -0
- package/client/mixin/meta-basic-grist-mixin.js +283 -0
- package/client/mixin/meta-button-mixin.js +116 -0
- package/client/mixin/meta-form-mixin.js +435 -0
- package/client/mixin/meta-grist-tab-mixin.js +335 -0
- package/client/mixin/meta-main-tab-mixin.js +267 -0
- package/client/mixin/meta-master-detail-mixin.js +395 -0
- package/client/mixin/meta-service-mixin.js +306 -0
- package/client/mixin/meta-tab-detail-mixin.js +283 -0
- package/client/mixin/meta-tab-mixin.js +190 -0
- package/client/pages/activity/meta-activity-define-page.js +422 -0
- package/client/pages/activity/meta-activity-list-page.js +262 -0
- package/client/pages/activity/meta-activity-viewer-element.js +35 -0
- package/client/pages/activity/meta-activity-writer-element.js +48 -0
- package/client/pages/activity/meta-activiy-mixin.js +79 -0
- package/client/pages/button-role/button-role-detail.js +50 -0
- package/client/pages/button-role/button-role-page.js +25 -0
- package/client/pages/doc-number/doc-number-page.js +24 -0
- package/client/pages/doc-number/next-doc-number-popup.js +25 -0
- package/client/pages/entity/config-entity.js +955 -0
- package/client/pages/entity/main-menu-selector.js +245 -0
- package/client/pages/history/history-copy-list-popup.js +145 -0
- package/client/pages/history/history-json-list-popup.js +159 -0
- package/client/pages/menu/dynamic-menu-template.js +92 -0
- package/client/pages/menu/dynamic-menu.ts +744 -0
- package/client/pages/menu/export-menu-popup.js +468 -0
- package/client/pages/meta-form-element.js +9 -0
- package/client/pages/meta-grist-element.js +12 -0
- package/client/pages/meta-grist-page.js +16 -0
- package/client/pages/meta-grist-tab-element.js +16 -0
- package/client/pages/meta-grist-tab-page.js +16 -0
- package/client/pages/meta-main-tab-element.js +12 -0
- package/client/pages/meta-main-tab-page.js +16 -0
- package/client/pages/meta-master-detail-element.js +12 -0
- package/client/pages/meta-master-detail-page.js +16 -0
- package/client/pages/meta-tab-detail-element.js +12 -0
- package/client/pages/meta-tab-detail-page.js +16 -0
- package/client/pages/meta-tab-element.js +15 -0
- package/client/pages/printer-device/printer-device-page.js +24 -0
- package/client/pages/template/doc-template-page.js +24 -0
- package/client/pages/template/template-file-page.js +24 -0
- package/client/pages/terms/config-terminology.js +214 -0
- package/client/pages/work-code/work-code-detail-popup.js +16 -0
- package/client/pages/work-code/work-code-page.js +23 -0
- package/client/route.ts +36 -0
- package/client/tsconfig.json +13 -0
- package/client/utils/grist-default-value.js +36 -0
- package/client/utils/meta-api.js +811 -0
- package/client/utils/meta-crypto.js +52 -0
- package/client/utils/meta-ui-util.js +3304 -0
- package/client/utils/rest-service-util.js +328 -0
- package/client/utils/service-util.js +1327 -0
- package/client/utils/terms-util.ts +119 -0
- package/client/utils/ui-util.js +338 -0
- package/client/utils/value-util.js +234 -0
- 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/server/activity/CommonActivity.ts +68 -0
- package/server/index.ts +3 -0
- package/server/routes.ts +61 -0
- package/server/service/button-role/button-role-mutation.ts +105 -0
- package/server/service/button-role/button-role-query.ts +53 -0
- package/server/service/button-role/button-role-type.ts +39 -0
- package/server/service/button-role/button-role.ts +61 -0
- package/server/service/button-role/index.ts +7 -0
- package/server/service/dynamic-menu/dynamic-menu-query.ts +270 -0
- package/server/service/dynamic-menu/dynamic-menu-type.ts +74 -0
- package/server/service/dynamic-menu/index.ts +3 -0
- package/server/service/entity-event-subscriber/entity-event-subscriber.ts +80 -0
- package/server/service/entity-event-subscriber/index.ts +3 -0
- package/server/service/index.ts +41 -0
- package/server/service/menu-button-auth/index.ts +7 -0
- package/server/service/menu-button-auth/menu-button-auth-mutation.ts +133 -0
- package/server/service/menu-button-auth/menu-button-auth-query.ts +138 -0
- package/server/service/menu-button-auth/menu-button-auth-type.ts +63 -0
- package/server/service/menu-button-auth/menu-button-auth.ts +92 -0
- package/server/service/meta-activity/index.ts +5 -0
- package/server/service/meta-activity/meta-activity-mutation.ts +191 -0
- package/server/service/meta-activity/meta-activity-query.ts +43 -0
- package/server/service/meta-activity/meta-activity-type.ts +56 -0
- package/server/service/set-translations/index.ts +3 -0
- package/server/service/set-translations/set-translation-resolver.ts +63 -0
- package/server/service/work-code/index.ts +6 -0
- package/server/service/work-code/work-code-mutation.ts +147 -0
- package/server/service/work-code/work-code-query.ts +67 -0
- package/server/service/work-code/work-code-type.ts +60 -0
- package/server/service/work-code/work-code.ts +83 -0
- package/server/service/work-code-detail/index.ts +6 -0
- package/server/service/work-code-detail/work-code-detail-mutation.ts +149 -0
- package/server/service/work-code-detail/work-code-detail-query.ts +59 -0
- package/server/service/work-code-detail/work-code-detail-type.ts +50 -0
- package/server/service/work-code-detail/work-code-detail.ts +82 -0
- package/server/tsconfig.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/meta-ui",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,29 +27,29 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@material/web": "^2.0.0",
|
|
30
|
-
"@operato/barcode": "^8.0.0
|
|
31
|
-
"@operato/data-grist": "^8.0.0
|
|
32
|
-
"@operato/form": "^8.0.0
|
|
33
|
-
"@operato/i18n": "^8.0.0
|
|
34
|
-
"@operato/input": "^8.0.0
|
|
35
|
-
"@operato/layout": "^8.0.0
|
|
36
|
-
"@operato/menu": "^8.0.0
|
|
37
|
-
"@operato/moment-timezone-es": "^8.0.0
|
|
38
|
-
"@operato/p13n": "^8.0.0
|
|
39
|
-
"@operato/popup": "^8.0.0
|
|
40
|
-
"@operato/shell": "^8.0.0
|
|
41
|
-
"@operato/styles": "^8.0.0
|
|
42
|
-
"@operato/time-calculator": "^8.0.0
|
|
43
|
-
"@operato/utils": "^8.0.0
|
|
44
|
-
"@things-factory/auth-base": "^8.0.0
|
|
45
|
-
"@things-factory/env": "^8.0.0
|
|
46
|
-
"@things-factory/id-rule-base": "^8.0.0
|
|
47
|
-
"@things-factory/menu-base": "^8.0.0
|
|
48
|
-
"@things-factory/personalization": "^8.0.0
|
|
49
|
-
"@things-factory/resource-base": "^8.0.0
|
|
50
|
-
"@things-factory/shell": "^8.0.0
|
|
51
|
-
"@things-factory/worklist": "^8.0.0
|
|
30
|
+
"@operato/barcode": "^8.0.0",
|
|
31
|
+
"@operato/data-grist": "^8.0.0",
|
|
32
|
+
"@operato/form": "^8.0.0",
|
|
33
|
+
"@operato/i18n": "^8.0.0",
|
|
34
|
+
"@operato/input": "^8.0.0",
|
|
35
|
+
"@operato/layout": "^8.0.0",
|
|
36
|
+
"@operato/menu": "^8.0.0",
|
|
37
|
+
"@operato/moment-timezone-es": "^8.0.0",
|
|
38
|
+
"@operato/p13n": "^8.0.0",
|
|
39
|
+
"@operato/popup": "^8.0.0",
|
|
40
|
+
"@operato/shell": "^8.0.0",
|
|
41
|
+
"@operato/styles": "^8.0.0",
|
|
42
|
+
"@operato/time-calculator": "^8.0.0",
|
|
43
|
+
"@operato/utils": "^8.0.0",
|
|
44
|
+
"@things-factory/auth-base": "^8.0.0",
|
|
45
|
+
"@things-factory/env": "^8.0.0",
|
|
46
|
+
"@things-factory/id-rule-base": "^8.0.0",
|
|
47
|
+
"@things-factory/menu-base": "^8.0.0",
|
|
48
|
+
"@things-factory/personalization": "^8.0.0",
|
|
49
|
+
"@things-factory/resource-base": "^8.0.0",
|
|
50
|
+
"@things-factory/shell": "^8.0.0",
|
|
51
|
+
"@things-factory/worklist": "^8.0.0",
|
|
52
52
|
"moment-timezone": "^0.5.45"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "07ef27d272dd9a067a9648ac7013748510556a18"
|
|
55
55
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ActivityInstance, /* post, */ UpdateActivityInstanceStateAddendum } from '@things-factory/worklist'
|
|
2
|
+
import { Scenario } from '@things-factory/integration-base'
|
|
3
|
+
import { getRepository, GraphqlLocalClient } from '@things-factory/shell'
|
|
4
|
+
|
|
5
|
+
import gql from 'graphql-tag'
|
|
6
|
+
|
|
7
|
+
export async function callback(
|
|
8
|
+
activityInstance: ActivityInstance,
|
|
9
|
+
addendum: UpdateActivityInstanceStateAddendum,
|
|
10
|
+
context: ResolverContext
|
|
11
|
+
) {
|
|
12
|
+
const { domain } = context.state
|
|
13
|
+
const { causedBy } = addendum || {}
|
|
14
|
+
|
|
15
|
+
let instanceName = ''
|
|
16
|
+
let scenarioName = `${activityInstance.activity.name}-activity-callback`
|
|
17
|
+
|
|
18
|
+
if ((await existsScenario(domain, scenarioName)) == false) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let variables = {
|
|
23
|
+
activityInstance,
|
|
24
|
+
causedBy
|
|
25
|
+
/* post */
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
await runScenario(context, instanceName, scenarioName, variables)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function existsScenario(domain: any, scenarioName: string): Promise<Boolean> {
|
|
32
|
+
var repository = getRepository(Scenario)
|
|
33
|
+
var scenario = await repository.findOne({
|
|
34
|
+
where: { domain: { id: domain.id }, name: scenarioName },
|
|
35
|
+
relations: ['domain', 'steps', 'creator', 'updater']
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
if (!scenario) {
|
|
39
|
+
return false
|
|
40
|
+
}
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function runScenario(context: any, instanceName: String, scenarioName: String, variables: any): Promise<void> {
|
|
45
|
+
// await ScenarioInstanceMutation.runScenario(instanceName,scenarioName,variables,context);
|
|
46
|
+
var client = GraphqlLocalClient.client
|
|
47
|
+
|
|
48
|
+
await client.mutate({
|
|
49
|
+
mutation: gql`
|
|
50
|
+
mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
|
|
51
|
+
runScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
|
|
52
|
+
instanceName
|
|
53
|
+
scenarioName
|
|
54
|
+
state
|
|
55
|
+
result
|
|
56
|
+
message
|
|
57
|
+
timestamp
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
variables: {
|
|
62
|
+
instanceName,
|
|
63
|
+
scenarioName,
|
|
64
|
+
variables
|
|
65
|
+
},
|
|
66
|
+
context
|
|
67
|
+
})
|
|
68
|
+
}
|
package/server/index.ts
ADDED
package/server/routes.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ActivityInstallations, Activity, ActivityStatus } from '@things-factory/worklist'
|
|
2
|
+
import { getRepository } from '@things-factory/shell'
|
|
3
|
+
import { callback } from './activity/CommonActivity'
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const { appRootPath } = require('@things-factory/env')
|
|
6
|
+
const AppPackage = require(path.resolve(appRootPath, 'package.json'))
|
|
7
|
+
|
|
8
|
+
process.on('bootstrap-module-global-public-route' as any, async (app: any, globalPublicRouter) => {
|
|
9
|
+
/*
|
|
10
|
+
* can add global public routes to application (auth not required, tenancy not required)
|
|
11
|
+
*
|
|
12
|
+
* ex) routes.get('/path', async(context, next) => {})
|
|
13
|
+
* ex) routes.post('/path', async(context, next) => {})
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const releaseActivityTemplates: Activity[] = await getRepository(Activity).find({
|
|
17
|
+
where: { state: ActivityStatus.Released }
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
;(releaseActivityTemplates || []).forEach(activity => {
|
|
21
|
+
if (activity.model && activity.model.some(x => x.name == 'relation-menu')) {
|
|
22
|
+
ActivityInstallations.installActivityTemplate({
|
|
23
|
+
name: `${activity.name}`,
|
|
24
|
+
release: AppPackage.version,
|
|
25
|
+
description: activity.description,
|
|
26
|
+
provider: AppPackage.provider,
|
|
27
|
+
// category: activity.category,
|
|
28
|
+
activityType: activity.activityType,
|
|
29
|
+
priority: activity.priority,
|
|
30
|
+
// searchKeys: [],
|
|
31
|
+
// startable: true,
|
|
32
|
+
startingType: activity.startingType,
|
|
33
|
+
model: activity.model,
|
|
34
|
+
uiType: activity.uiType,
|
|
35
|
+
uiSource: activity.uiSource,
|
|
36
|
+
viewType: activity.viewType,
|
|
37
|
+
viewSource: activity.viewSource,
|
|
38
|
+
activity: activity,
|
|
39
|
+
callback
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
|
|
46
|
+
/*
|
|
47
|
+
* can add global private routes to application (auth required, tenancy not required)
|
|
48
|
+
*/
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
process.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {
|
|
52
|
+
/*
|
|
53
|
+
* can add domain public routes to application (auth not required, tenancy required)
|
|
54
|
+
*/
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
|
|
58
|
+
/*
|
|
59
|
+
* can add domain private routes to application (auth required, tenancy required)
|
|
60
|
+
*/
|
|
61
|
+
})
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { ButtonRole } from './button-role'
|
|
3
|
+
import { NewButtonRole, ButtonRolePatch } from './button-role-type'
|
|
4
|
+
|
|
5
|
+
@Resolver(ButtonRole)
|
|
6
|
+
export class ButtonRoleMutation {
|
|
7
|
+
@Directive('@transaction')
|
|
8
|
+
@Mutation(returns => ButtonRole, { description: 'To create new ButtonRole' })
|
|
9
|
+
async createButtonRole(@Arg('buttonRole') buttonRole: NewButtonRole, @Ctx() context: any): Promise<ButtonRole> {
|
|
10
|
+
const { domain, user, tx } = context.state
|
|
11
|
+
|
|
12
|
+
return await tx.getRepository(ButtonRole).save({
|
|
13
|
+
...buttonRole,
|
|
14
|
+
domain,
|
|
15
|
+
creator: user,
|
|
16
|
+
updater: user
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Directive('@transaction')
|
|
21
|
+
@Mutation(returns => ButtonRole, { description: 'To modify ButtonRole information' })
|
|
22
|
+
async updateButtonRole(@Arg('id') id: string, @Arg('patch') patch: ButtonRolePatch, @Ctx() context: any): Promise<ButtonRole> {
|
|
23
|
+
const { domain, user, tx } = context.state
|
|
24
|
+
|
|
25
|
+
const repository = tx.getRepository(ButtonRole)
|
|
26
|
+
const buttonRole = await repository.findOne({
|
|
27
|
+
where: { domain: { id: domain.id }, id },
|
|
28
|
+
relations: ['domain', 'updater', 'creator']
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return await repository.save({
|
|
32
|
+
...buttonRole,
|
|
33
|
+
...patch,
|
|
34
|
+
updater: user
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@Directive('@transaction')
|
|
39
|
+
@Mutation(returns => [ButtonRole], { description: "To modify multiple buttonRoles' information" })
|
|
40
|
+
async updateMultipleButtonRole(@Arg('patches', type => [ButtonRolePatch]) patches: ButtonRolePatch[], @Ctx() context: any): Promise<ButtonRole[]> {
|
|
41
|
+
const { domain, user, tx } = context.state
|
|
42
|
+
|
|
43
|
+
let results = []
|
|
44
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
45
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
46
|
+
const buttonRoleRepo = tx.getRepository(ButtonRole)
|
|
47
|
+
|
|
48
|
+
if (_createRecords.length > 0) {
|
|
49
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
50
|
+
const newRecord = _createRecords[i]
|
|
51
|
+
|
|
52
|
+
const result = await buttonRoleRepo.save({
|
|
53
|
+
...newRecord,
|
|
54
|
+
domain,
|
|
55
|
+
creator: user,
|
|
56
|
+
updater: user
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
results.push({ ...result, cuFlag: '+' })
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (_updateRecords.length > 0) {
|
|
64
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
65
|
+
const updRecord = _updateRecords[i]
|
|
66
|
+
const buttonRole = await buttonRoleRepo.findOne({
|
|
67
|
+
where: { domain: { id: domain.id }, id: updRecord.id },
|
|
68
|
+
relations: ['domain', 'updater', 'creator']
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const result = await buttonRoleRepo.save({
|
|
72
|
+
...buttonRole,
|
|
73
|
+
...updRecord,
|
|
74
|
+
updater: user
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return results
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@Directive('@transaction')
|
|
85
|
+
@Mutation(returns => Boolean, { description: 'To delete ButtonRole' })
|
|
86
|
+
async deleteButtonRole(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
|
|
87
|
+
const { domain, tx, user } = context.state
|
|
88
|
+
await tx.getRepository(ButtonRole).remove({ domain, id, updater: user })
|
|
89
|
+
return true
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@Directive('@transaction')
|
|
93
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple ButtonRoles' })
|
|
94
|
+
async deleteButtonRoles(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
|
|
95
|
+
const { domain, tx, user } = context.state
|
|
96
|
+
|
|
97
|
+
let delEntitis = ids.map(id => {
|
|
98
|
+
return { domain, id, updater: user }
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
await tx.getRepository(ButtonRole).remove(delEntitis)
|
|
102
|
+
|
|
103
|
+
return true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import {
|
|
3
|
+
Domain,
|
|
4
|
+
ListParam,
|
|
5
|
+
convertListParams,
|
|
6
|
+
getRepository,
|
|
7
|
+
getQueryBuilderFromListParams
|
|
8
|
+
} from '@things-factory/shell'
|
|
9
|
+
import { User } from '@things-factory/auth-base'
|
|
10
|
+
import { ButtonRole } from './button-role'
|
|
11
|
+
import { ButtonRoleList } from './button-role-type'
|
|
12
|
+
|
|
13
|
+
@Resolver(ButtonRole)
|
|
14
|
+
export class ButtonRoleQuery {
|
|
15
|
+
@Query(returns => ButtonRole, { description: 'To fetch a ButtonRole' })
|
|
16
|
+
async buttonRole(@Arg('id') id: string, @Ctx() context: any): Promise<ButtonRole> {
|
|
17
|
+
const { domain } = context.state
|
|
18
|
+
return await getRepository(ButtonRole).findOne({
|
|
19
|
+
where: { domain: { id: domain.id }, id }
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Query(returns => ButtonRoleList, { description: 'To fetch a multiple ButtonRole' })
|
|
24
|
+
async buttonRoles(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<ButtonRoleList> {
|
|
25
|
+
const { domain } = context.state
|
|
26
|
+
|
|
27
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
28
|
+
domain,
|
|
29
|
+
params,
|
|
30
|
+
repository: await getRepository(ButtonRole),
|
|
31
|
+
searchables: ['name', 'description']
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
35
|
+
|
|
36
|
+
return { items, total }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@FieldResolver(type => Domain)
|
|
40
|
+
async domain(@Root() buttonRole: ButtonRole): Promise<Domain> {
|
|
41
|
+
return await getRepository(Domain).findOneBy({ id: buttonRole.domainId })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@FieldResolver(type => User)
|
|
45
|
+
async updater(@Root() buttonRole: ButtonRole): Promise<User> {
|
|
46
|
+
return await getRepository(User).findOneBy({ id: buttonRole.updaterId })
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@FieldResolver(type => User)
|
|
50
|
+
async creator(@Root() buttonRole: ButtonRole): Promise<User> {
|
|
51
|
+
return await getRepository(User).findOneBy({ id: buttonRole.creatorId })
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'
|
|
3
|
+
import { ObjectRef } from '@things-factory/shell'
|
|
4
|
+
|
|
5
|
+
import { ButtonRole } from './button-role'
|
|
6
|
+
|
|
7
|
+
@InputType()
|
|
8
|
+
export class NewButtonRole {
|
|
9
|
+
|
|
10
|
+
@Field({ nullable: false })
|
|
11
|
+
name: string
|
|
12
|
+
|
|
13
|
+
@Field({ nullable: true })
|
|
14
|
+
description?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@InputType()
|
|
18
|
+
export class ButtonRolePatch {
|
|
19
|
+
@Field(type => ID, { nullable: true })
|
|
20
|
+
id?: string
|
|
21
|
+
|
|
22
|
+
@Field({ nullable: true })
|
|
23
|
+
name?: string
|
|
24
|
+
|
|
25
|
+
@Field({ nullable: true })
|
|
26
|
+
description?: string
|
|
27
|
+
|
|
28
|
+
@Field()
|
|
29
|
+
cuFlag: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@ObjectType()
|
|
33
|
+
export class ButtonRoleList {
|
|
34
|
+
@Field(type => [ButtonRole])
|
|
35
|
+
items: ButtonRole[]
|
|
36
|
+
|
|
37
|
+
@Field(type => Int)
|
|
38
|
+
total: number
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
|
|
17
|
+
@Entity('button_roles')
|
|
18
|
+
@Index('ix_button_role_0', (buttonRole: ButtonRole) => [buttonRole.domain, buttonRole.name], { unique: true })
|
|
19
|
+
@ObjectType({ description: 'Entity for ButtonRole' })
|
|
20
|
+
export class ButtonRole {
|
|
21
|
+
@PrimaryGeneratedColumn('uuid')
|
|
22
|
+
@Field(type => ID)
|
|
23
|
+
readonly id: string
|
|
24
|
+
|
|
25
|
+
@Column({ name: 'name', type: 'character varying', length: 100, nullable: false })
|
|
26
|
+
@Field({ nullable: false })
|
|
27
|
+
name: string
|
|
28
|
+
|
|
29
|
+
@Column({ name: 'description', type: 'character varying', length: 255, nullable: true })
|
|
30
|
+
@Field({ nullable: true })
|
|
31
|
+
description: string
|
|
32
|
+
|
|
33
|
+
@ManyToOne(type => Domain)
|
|
34
|
+
@Field(type => Domain, { nullable: false })
|
|
35
|
+
domain: Domain
|
|
36
|
+
|
|
37
|
+
@RelationId((buttonRole: ButtonRole) => buttonRole.domain)
|
|
38
|
+
domainId: string
|
|
39
|
+
|
|
40
|
+
@CreateDateColumn()
|
|
41
|
+
@Field({ nullable: true })
|
|
42
|
+
createdAt?: Date
|
|
43
|
+
|
|
44
|
+
@UpdateDateColumn()
|
|
45
|
+
@Field({ nullable: true })
|
|
46
|
+
updatedAt?: Date
|
|
47
|
+
|
|
48
|
+
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
49
|
+
@Field(type => User, { nullable: true })
|
|
50
|
+
creator?: User
|
|
51
|
+
|
|
52
|
+
@RelationId((buttonRole: ButtonRole) => buttonRole.creator)
|
|
53
|
+
creatorId?: string
|
|
54
|
+
|
|
55
|
+
@ManyToOne(type => User, { createForeignKeyConstraints: false, nullable: true })
|
|
56
|
+
@Field(type => User, { nullable: true })
|
|
57
|
+
updater?: User
|
|
58
|
+
|
|
59
|
+
@RelationId((buttonRole: ButtonRole) => buttonRole.updater)
|
|
60
|
+
updaterId?: string
|
|
61
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { ButtonRole } from './button-role'
|
|
3
|
+
import { ButtonRoleQuery } from './button-role-query'
|
|
4
|
+
import { ButtonRoleMutation } from './button-role-mutation'
|
|
5
|
+
|
|
6
|
+
export const entities = [ButtonRole]
|
|
7
|
+
export const resolvers = [ButtonRoleQuery, ButtonRoleMutation]
|