cabloy 5.1.65 → 5.1.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/CHANGELOG.md +44 -0
- package/cabloy-docs/.vitepress/config.mjs +1 -1
- package/cabloy-docs/backend/crud-workflow.md +33 -0
- package/cabloy-docs/backend/master-detail-workflow.md +149 -0
- package/cabloy-docs/frontend/bean-scene-authoring.md +1 -1
- package/cabloy-docs/frontend/cli.md +12 -1
- package/cabloy-docs/frontend/command-scene-authoring.md +12 -1
- package/cabloy-docs/frontend/component-guide.md +10 -0
- package/cabloy-docs/frontend/permission-formscene-action-visibility-guide.md +69 -7
- package/cabloy-docs/frontend/table-cell-cookbook.md +10 -0
- package/cabloy-docs/fullstack/backend-metadata-to-frontend-table-actions.md +83 -2
- package/cabloy-docs/reference/bean-scene-boilerplates.md +9 -4
- package/package.json +1 -1
- package/vona/packages-cli/cabloy-cli/package.json +1 -1
- package/vona/packages-cli/cabloy-cli/src/lib/local.helper.ts +38 -0
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoBaseName%>.tsx_ +18 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoMutateName%>.tsx_ +17 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoResItemName%>.tsx_ +60 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/masterDetail/boilerplate/dto/<%=argv.detailDtoViewName%>.tsx_ +17 -0
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.bean.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.module.ts +3 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.suite.ts +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.test.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.asset.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.config.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.constant.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.error.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.lib.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.locale.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.main.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.monkey.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.static.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.types.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crud.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudBasic.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudStart.ts +2 -6
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.masterDetail.ts +699 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.metadata.ts +1 -2
- package/vona/packages-cli/cli-set-api/src/lib/beans.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/command/tools.masterDetail.ts +78 -0
- package/vona/packages-cli/cli-set-api/src/lib/commands.ts +2 -0
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-core/src/lib/mappedClass/type.ts +1 -0
- package/vona/packages-vona/vona-core/src/lib/mappedClass/utils.ts +36 -14
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +20 -11
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordBase.tsx +8 -2
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordMutate.tsx +1 -15
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordResItem.tsx +25 -5
- package/vona/src/suite/a-training/modules/training-student/src/dto/detailRecordView.tsx +1 -12
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentCreate.tsx +6 -4
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +3 -6
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSummary.tsx +1 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentUpdate.tsx +14 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentView.tsx +14 -1
- package/vona/src/suite/a-training/modules/training-student/src/entity/student.tsx +1 -5
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +9 -4
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/const/decorator.ts +3 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/schema/makeSchemaLikes.ts +21 -17
- package/vona/src/suite-vendor/a-vona/modules/a-openapiutils/src/lib/utils.ts +44 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoGet.ts +2 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoMutate.ts +8 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/service/relations_.ts +32 -16
- package/vona/src/suite-vendor/a-vona/modules/a-web/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/bean.ts +26 -5
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +3 -3
- package/zova/packages-cli/cli-set-front/cli/templates/create/component/boilerplateDetailsActionBulk/controller.tsx_ +31 -0
- package/zova/packages-cli/cli-set-front/cli/templates/rest/component.ts +21 -0
- package/zova/packages-cli/cli-set-front/cli/templates/rest/render.ts +4 -0
- package/zova/packages-cli/cli-set-front/package.json +2 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.bean.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.mock.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.module.ts +3 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.suite.ts +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.asset.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.config.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.constant.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.error.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.icon.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.lib.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.locale.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.main.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.mainSys.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.monkey.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.monkeySys.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.types.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.config.ts +1 -4
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.openapi.generate.ts +2 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.anotherRender.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.anotherStyle.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentEmits.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentGeneric.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentModel.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentProps.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.componentSlots.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.firstRender.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.firstStyle.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.pageParams.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.pageQuery.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.refactor.renameComponent.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.tools.metadata.ts +1 -2
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreateComponent.ts +2 -6
- package/zova/packages-cli/cli-set-front/src/lib/common/cliCreatePage.ts +2 -6
- package/zova/packages-zova/zova/package.json +2 -2
- package/zova/pnpm-lock.yaml +744 -884
- package/zova/src/suite/a-training/modules/training-student/package.json +2 -1
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/bean/behavior.appModal.tsx +131 -13
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/config/config.ts +15 -0
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/service/appModal.ts +23 -5
- package/zova/src/suite/cabloy-basic/modules/basic-app/src/types/appModal.ts +30 -4
- package/zova/src/suite/cabloy-basic/modules/basic-details/package.json +6 -1
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/component/blockForm.ts +31 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/.metadata/index.ts +149 -2
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/command.delete.tsx +47 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionDelete.tsx +52 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionOperationsRow.tsx +44 -6
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionUpdate.tsx +73 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.actionView.tsx +64 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/bean/tableCell.lineNumber.tsx +30 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/actionCreate/controller.tsx +29 -5
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockDetails/controller.tsx +28 -12
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockForm/controller.tsx +53 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockTable/controller.tsx +7 -2
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockToolbarBulk/controller.tsx +3 -1
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/formFieldDetails/controller.tsx +24 -12
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/en-us.ts +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/config/locale/zh-cn.ts +4 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/lib/index.ts +1 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/lib/utils.ts +12 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/service/detail.tsx +172 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/detail.ts +18 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/details.ts +11 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/dialogForm.ts +22 -0
- package/zova/src/suite/cabloy-basic/modules/basic-details/src/types/index.ts +2 -0
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/package.json +1 -1
- package/zova/src/suite-vendor/a-cabloy/modules/rest-resource/src/page/entry/controller.tsx +1 -2
- package/zova/src/suite-vendor/a-cabloy/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/command/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandBulk/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandDetailsRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +20 -0
- package/zova/src/suite-vendor/a-zova/modules/a-command/cli/commandRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +6 -1
- package/zova/src/suite-vendor/a-zova/modules/a-command/package.json +3 -2
- package/zova/src/suite-vendor/a-zova/modules/a-command/src/types/command.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-form/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-form/src/component/form/controller.tsx +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/lib/schema.ts +20 -4
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/action.ts +2 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/detail.ts +10 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/details.ts +4 -1
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/detail/index.ts +1 -0
- package/zova/src/suite-vendor/a-zova/modules/a-openapi/src/types/rest.ts +2 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/cli/detailsActionRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +24 -0
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +3 -2
- package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/controller.tsx +5 -3
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +6 -6
|
@@ -26,6 +26,7 @@ import { CliToolsCrud } from './bean/cli.tools.crud.ts';
|
|
|
26
26
|
import { CliToolsCrudBasic } from './bean/cli.tools.crudBasic.ts';
|
|
27
27
|
import { CliToolsCrudStart } from './bean/cli.tools.crudStart.ts';
|
|
28
28
|
import { CliToolsDeps } from './bean/cli.tools.deps.ts';
|
|
29
|
+
import { CliToolsMasterDetail } from './bean/cli.tools.masterDetail.ts';
|
|
29
30
|
import { CliToolsMetadata } from './bean/cli.tools.metadata.ts';
|
|
30
31
|
|
|
31
32
|
export const beans = {
|
|
@@ -58,4 +59,5 @@ export const beans = {
|
|
|
58
59
|
'tools.crudBasic': CliToolsCrudBasic,
|
|
59
60
|
'tools.crudStart': CliToolsCrudStart,
|
|
60
61
|
'tools.crud': CliToolsCrud,
|
|
62
|
+
'tools.masterDetail': CliToolsMasterDetail,
|
|
61
63
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
bean: 'tools.masterDetail',
|
|
3
|
+
info: {
|
|
4
|
+
version: '5.0.0',
|
|
5
|
+
title: 'Cli: Tools: Master Detail',
|
|
6
|
+
usage:
|
|
7
|
+
'npm run vona :tools:masterDetail resourceName -- [--module=] [--detailModule=] [--detailResourceName=] [--relationName=] [--fk=] [--detailMode=aggregate|standalone]',
|
|
8
|
+
},
|
|
9
|
+
options: {
|
|
10
|
+
module: {
|
|
11
|
+
description: 'master module relative name, such as training-student',
|
|
12
|
+
type: 'string',
|
|
13
|
+
},
|
|
14
|
+
detailModule: {
|
|
15
|
+
description: 'detail module relative name, such as training-record',
|
|
16
|
+
type: 'string',
|
|
17
|
+
},
|
|
18
|
+
detailResourceName: {
|
|
19
|
+
description: 'detail resource name',
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
relationName: {
|
|
23
|
+
description: 'master relation name',
|
|
24
|
+
type: 'string',
|
|
25
|
+
},
|
|
26
|
+
fk: {
|
|
27
|
+
description: 'detail foreign key field name',
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
detailMode: {
|
|
31
|
+
description: 'detail mode: aggregate or standalone',
|
|
32
|
+
type: 'string',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
groups: {
|
|
36
|
+
default: {
|
|
37
|
+
questions: {
|
|
38
|
+
resourceName: {
|
|
39
|
+
type: 'input',
|
|
40
|
+
message: 'master resourceName',
|
|
41
|
+
initial: {
|
|
42
|
+
expression: 'arg0',
|
|
43
|
+
},
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
module: {
|
|
47
|
+
type: 'input',
|
|
48
|
+
message: 'master module relative name (for example training-student)',
|
|
49
|
+
required: true,
|
|
50
|
+
},
|
|
51
|
+
detailModule: {
|
|
52
|
+
type: 'input',
|
|
53
|
+
message: 'detail module relative name (for example training-record)',
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
detailResourceName: {
|
|
57
|
+
type: 'input',
|
|
58
|
+
message: 'detail resourceName',
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
relationName: {
|
|
62
|
+
type: 'input',
|
|
63
|
+
message: 'master relation name',
|
|
64
|
+
},
|
|
65
|
+
fk: {
|
|
66
|
+
type: 'input',
|
|
67
|
+
message: 'detail foreign key field name',
|
|
68
|
+
},
|
|
69
|
+
detailMode: {
|
|
70
|
+
type: 'input',
|
|
71
|
+
message: 'detail mode (aggregate|standalone)',
|
|
72
|
+
initial: 'aggregate',
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -26,6 +26,7 @@ import toolsCrud from './command/tools.crud.ts';
|
|
|
26
26
|
import toolsCrudBasic from './command/tools.crudBasic.ts';
|
|
27
27
|
import toolsCrudStart from './command/tools.crudStart.ts';
|
|
28
28
|
import toolsDeps from './command/tools.deps.ts';
|
|
29
|
+
import toolsMasterDetail from './command/tools.masterDetail.ts';
|
|
29
30
|
import toolsMetadata from './command/tools.metadata.ts';
|
|
30
31
|
|
|
31
32
|
export const commands = {
|
|
@@ -68,5 +69,6 @@ export const commands = {
|
|
|
68
69
|
crudBasic: toolsCrudBasic,
|
|
69
70
|
crudStart: toolsCrudStart,
|
|
70
71
|
crud: toolsCrud,
|
|
72
|
+
masterDetail: toolsMasterDetail,
|
|
71
73
|
},
|
|
72
74
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.53",
|
|
4
4
|
"gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
|
|
5
5
|
"description": "Vona is an intuitive, elegant and powerful Node.js framework for rapidly developing enterprise applications of any size",
|
|
6
6
|
"keywords": [
|
|
@@ -5,5 +5,6 @@ export const SymbolMappedClassMetadataKeys = Symbol('SymbolMappedClassMetakeys')
|
|
|
5
5
|
export type MappedClassMetadataKeys = Record<MetadataKey, IMappedClassMetadataOptions | undefined>;
|
|
6
6
|
|
|
7
7
|
export interface IMappedClassMetadataOptions {
|
|
8
|
+
replace?: boolean;
|
|
8
9
|
partialClass?: Function;
|
|
9
10
|
}
|
|
@@ -81,22 +81,44 @@ export function copyMetadataOfClasses(target: object, sources: object[], transfo
|
|
|
81
81
|
setMappedClassMetadataKeys(target, metadataKeys);
|
|
82
82
|
//
|
|
83
83
|
for (const metadataKey of Object.getOwnPropertySymbols(metadataKeys)) {
|
|
84
|
-
const metadataKeyOptions = metadataKeys[metadataKey];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
const metadataKeyOptions: IMappedClassMetadataOptions = metadataKeys[metadataKey];
|
|
85
|
+
if (metadataKeyOptions.replace) {
|
|
86
|
+
_copyMetadataOfClassesReplace(metadataKey, target, sources);
|
|
87
|
+
} else {
|
|
88
|
+
_copyMetadataOfClassesMap(metadataKey, metadataKeyOptions, target, sources, transform);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function _copyMetadataOfClassesReplace(metadataKey: symbol, target: object, sources: object[]) {
|
|
94
|
+
let valueNew;
|
|
95
|
+
for (const source of sources) {
|
|
96
|
+
valueNew = appMetadata.getMetadata(metadataKey, source);
|
|
97
|
+
}
|
|
98
|
+
appMetadata.defineMetadata(metadataKey, valueNew, target);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function _copyMetadataOfClassesMap(
|
|
102
|
+
metadataKey: symbol,
|
|
103
|
+
metadataKeyOptions: IMappedClassMetadataOptions,
|
|
104
|
+
target: object,
|
|
105
|
+
sources: object[],
|
|
106
|
+
transform?: Function,
|
|
107
|
+
) {
|
|
108
|
+
const rulesNew = {};
|
|
109
|
+
for (const source of sources) {
|
|
110
|
+
const rules = appMetadata.getMetadata(metadataKey, source);
|
|
111
|
+
if (!rules) continue;
|
|
112
|
+
if (!transform) {
|
|
113
|
+
Object.assign(rulesNew, rules);
|
|
114
|
+
} else {
|
|
115
|
+
for (const key in rules) {
|
|
116
|
+
const ruleNew = transform(rules, key, metadataKeyOptions);
|
|
117
|
+
if (ruleNew !== undefined) {
|
|
118
|
+
rulesNew[key] = ruleNew;
|
|
97
119
|
}
|
|
98
120
|
}
|
|
99
121
|
}
|
|
100
|
-
appMetadata.defineMetadata(metadataKey, rulesNew, target);
|
|
101
122
|
}
|
|
123
|
+
appMetadata.defineMetadata(metadataKey, rulesNew, target);
|
|
102
124
|
}
|
package/vona/pnpm-lock.yaml
CHANGED
|
@@ -7421,6 +7421,9 @@ packages:
|
|
|
7421
7421
|
zova-module-a-openapi@5.1.35:
|
|
7422
7422
|
resolution: {integrity: sha512-DT7KUxOpLAWfCvXkBvE4VPfTv+2zlMEGQuFg5QI00GNaSCEs7fmB4nNWDf6cZRr4OBTXOzYAmfgDoM4q19/V9g==}
|
|
7423
7423
|
|
|
7424
|
+
zova-module-a-openapi@5.1.36:
|
|
7425
|
+
resolution: {integrity: sha512-Sm5U1Im3kIumriz6w9xtab9QK2p8atAINIQIiP9Bcu46M2OA7gWDWR/jfdty2/G+nDBOn54+3yxHEWQZ9raCiQ==}
|
|
7426
|
+
|
|
7424
7427
|
zova-module-a-router@5.1.26:
|
|
7425
7428
|
resolution: {integrity: sha512-TMNPX62+haeqNk0KejrH6ID5HLdi6CngRC7B1XsnjqKR8E0eQJL1YxxrPkaf4AQQKc9c9BHjRdL6EEZFqintiQ==}
|
|
7426
7429
|
|
|
@@ -7466,14 +7469,14 @@ packages:
|
|
|
7466
7469
|
zova-suite-a-zova@5.1.102:
|
|
7467
7470
|
resolution: {integrity: sha512-R5HB45pBHN9lZhWRmCuWH0DSMcDb6iBsgCQojxSZNsD8ttSCvWyu2FwNAmCQFguwEuPyZw8ZZndwr/8HAU3IxQ==}
|
|
7468
7471
|
|
|
7469
|
-
zova-suite-a-zova@5.1.
|
|
7470
|
-
resolution: {integrity: sha512-
|
|
7472
|
+
zova-suite-a-zova@5.1.105:
|
|
7473
|
+
resolution: {integrity: sha512-34A9uB8A0rPBW6akpYl2nCSzck7jEi+D9PQJwDVx5Ms01sLhzdQk9QIf3Ux3uxoa4nmAnyDEtxKgvPSoUdpgPQ==}
|
|
7471
7474
|
|
|
7472
7475
|
zova@5.1.103:
|
|
7473
7476
|
resolution: {integrity: sha512-AR+Pk9hozKvB6/R/fZ4WPtKX4I0TJxmHx8Ao8dpLovlXhacYi50dUHOTxUQDavwspkWjMDinNqjQWo2MpAVc9g==}
|
|
7474
7477
|
|
|
7475
|
-
zova@5.1.
|
|
7476
|
-
resolution: {integrity: sha512-
|
|
7478
|
+
zova@5.1.106:
|
|
7479
|
+
resolution: {integrity: sha512-zRNxKjKZi9yxBpWixQmz/OVdmh4KzZwpGSD1r6fk6q0jrU4JmfJ7VETNlN4PsSPZ3/Bu3Z9MwlmI/nCbNV9cFg==}
|
|
7477
7480
|
|
|
7478
7481
|
zwitch@1.0.5:
|
|
7479
7482
|
resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==}
|
|
@@ -13045,6 +13048,12 @@ snapshots:
|
|
|
13045
13048
|
openapi3-ts: 4.6.0
|
|
13046
13049
|
typestyle: 2.4.0
|
|
13047
13050
|
|
|
13051
|
+
zova-module-a-openapi@5.1.36:
|
|
13052
|
+
dependencies:
|
|
13053
|
+
'@cabloy/json-schema-to-zod': 2.6.4
|
|
13054
|
+
openapi3-ts: 4.6.0
|
|
13055
|
+
typestyle: 2.4.0
|
|
13056
|
+
|
|
13048
13057
|
zova-module-a-router@5.1.26: {}
|
|
13049
13058
|
|
|
13050
13059
|
zova-module-a-routerstack@5.1.23: {}
|
|
@@ -13117,7 +13126,7 @@ snapshots:
|
|
|
13117
13126
|
table-identity: link:packages-utils/table-identity
|
|
13118
13127
|
vue: 3.5.38(typescript@5.9.3)
|
|
13119
13128
|
zod: '@cabloy/zod@4.3.6'
|
|
13120
|
-
zova: 5.1.
|
|
13129
|
+
zova: 5.1.106(typescript@5.9.3)(vue@3.5.38(typescript@5.9.3))
|
|
13121
13130
|
zova-jsx: 1.1.63(typescript@5.9.3)
|
|
13122
13131
|
zova-module-a-api: 5.1.18
|
|
13123
13132
|
zova-module-a-bean: 5.1.28
|
|
@@ -13127,7 +13136,7 @@ snapshots:
|
|
|
13127
13136
|
zova-module-a-icon: 5.1.23
|
|
13128
13137
|
zova-module-a-interceptor: 5.1.26
|
|
13129
13138
|
zova-module-a-model: 5.1.27(vue@3.5.38(typescript@5.9.3))
|
|
13130
|
-
zova-module-a-openapi: 5.1.
|
|
13139
|
+
zova-module-a-openapi: 5.1.36
|
|
13131
13140
|
zova-module-a-router: 5.1.26
|
|
13132
13141
|
zova-module-a-routertabs: 5.1.29
|
|
13133
13142
|
zova-module-a-ssr: 5.1.23
|
|
@@ -13187,7 +13196,7 @@ snapshots:
|
|
|
13187
13196
|
zova-module-a-logger: 5.1.23
|
|
13188
13197
|
zova-module-a-meta: 5.1.18
|
|
13189
13198
|
zova-module-a-model: 5.1.27(vue@3.5.38(typescript@5.9.3))
|
|
13190
|
-
zova-module-a-openapi: 5.1.
|
|
13199
|
+
zova-module-a-openapi: 5.1.35
|
|
13191
13200
|
zova-module-a-router: 5.1.26
|
|
13192
13201
|
zova-module-a-routerstack: 5.1.23
|
|
13193
13202
|
zova-module-a-routertabs: 5.1.29
|
|
@@ -13205,7 +13214,7 @@ snapshots:
|
|
|
13205
13214
|
- typescript
|
|
13206
13215
|
- vue
|
|
13207
13216
|
|
|
13208
|
-
zova-suite-a-zova@5.1.
|
|
13217
|
+
zova-suite-a-zova@5.1.105(typescript@5.9.3)(vue@3.5.38(typescript@5.9.3)):
|
|
13209
13218
|
dependencies:
|
|
13210
13219
|
zova-module-a-api: 5.1.18
|
|
13211
13220
|
zova-module-a-app: 5.1.21
|
|
@@ -13221,7 +13230,7 @@ snapshots:
|
|
|
13221
13230
|
zova-module-a-logger: 5.1.23
|
|
13222
13231
|
zova-module-a-meta: 5.1.18
|
|
13223
13232
|
zova-module-a-model: 5.1.27(vue@3.5.38(typescript@5.9.3))
|
|
13224
|
-
zova-module-a-openapi: 5.1.
|
|
13233
|
+
zova-module-a-openapi: 5.1.36
|
|
13225
13234
|
zova-module-a-router: 5.1.26
|
|
13226
13235
|
zova-module-a-routerstack: 5.1.23
|
|
13227
13236
|
zova-module-a-routertabs: 5.1.29
|
|
@@ -13250,10 +13259,10 @@ snapshots:
|
|
|
13250
13259
|
- typescript
|
|
13251
13260
|
- vue
|
|
13252
13261
|
|
|
13253
|
-
zova@5.1.
|
|
13262
|
+
zova@5.1.106(typescript@5.9.3)(vue@3.5.38(typescript@5.9.3)):
|
|
13254
13263
|
dependencies:
|
|
13255
13264
|
zova-core: 5.1.57(typescript@5.9.3)
|
|
13256
|
-
zova-suite-a-zova: 5.1.
|
|
13265
|
+
zova-suite-a-zova: 5.1.105(typescript@5.9.3)(vue@3.5.38(typescript@5.9.3))
|
|
13257
13266
|
transitivePeerDependencies:
|
|
13258
13267
|
- '@vue/composition-api'
|
|
13259
13268
|
- debug
|
|
@@ -13,4 +13,7 @@ export default {
|
|
|
13
13
|
DescriptionLength: 'Description Length',
|
|
14
14
|
ForceDelete: 'Force Delete',
|
|
15
15
|
TrainingRecords: 'Training Records',
|
|
16
|
+
AddTrainingRecord: 'Add Training Record',
|
|
17
|
+
EditTrainingRecord: 'Edit Training Record',
|
|
18
|
+
ViewTrainingRecord: 'View Training Record',
|
|
16
19
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
|
|
3
|
+
import { $makeMetadata } from 'vona-module-a-openapiutils';
|
|
3
4
|
import { $Dto } from 'vona-module-a-orm';
|
|
4
5
|
import { Dto } from 'vona-module-a-web';
|
|
5
6
|
import { ModelRecord } from 'vona-module-training-record';
|
|
7
|
+
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
6
8
|
|
|
7
9
|
export interface IDtoOptionsDetailRecordBase extends IDecoratorDtoOptions {}
|
|
8
10
|
|
|
9
|
-
@Dto<IDtoOptionsDetailRecordBase>(
|
|
11
|
+
@Dto<IDtoOptionsDetailRecordBase>({
|
|
12
|
+
fields: {
|
|
13
|
+
id: $makeMetadata(ZovaRender.visible(false)),
|
|
14
|
+
},
|
|
15
|
+
})
|
|
10
16
|
export class DtoDetailRecordBase extends $Dto.get(() => ModelRecord, {
|
|
11
|
-
columns: ['id', 'name', 'score', 'description'],
|
|
17
|
+
columns: ['id', 'deleted', 'name', 'score', 'description'],
|
|
12
18
|
}) {}
|
|
@@ -10,21 +10,7 @@ import { DtoDetailRecordBase } from './detailRecordBase.tsx';
|
|
|
10
10
|
export interface IDtoOptionsDetailRecordMutate extends IDecoratorDtoOptions {}
|
|
11
11
|
|
|
12
12
|
@Dto<IDtoOptionsDetailRecordMutate>({
|
|
13
|
-
blocks: [
|
|
14
|
-
ZovaRender.block('basic-pageentry:blockPageEntry', {
|
|
15
|
-
blocks: [
|
|
16
|
-
ZovaRender.block('basic-pageentry:blockForm'),
|
|
17
|
-
ZovaRender.block('basic-pageentry:blockToolbarRow', {
|
|
18
|
-
actions: [
|
|
19
|
-
ZovaRender.formActionRow('basic-form:actionSubmit', {
|
|
20
|
-
permission: { actionInherit: 'update', formScene: ['create', 'edit'] },
|
|
21
|
-
}),
|
|
22
|
-
ZovaRender.formActionRow('basic-form:actionBack', { permission: { public: true } }),
|
|
23
|
-
],
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
13
|
+
blocks: [ZovaRender.block('basic-details:blockForm')],
|
|
28
14
|
})
|
|
29
15
|
export class DtoDetailRecordMutate extends $Dto.mutate(() => ModelRecord, {
|
|
30
16
|
dtoClass: DtoDetailRecordBase,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
|
|
3
|
-
import { Api, v } from 'vona-module-a-openapiutils';
|
|
3
|
+
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
4
4
|
import { $Dto } from 'vona-module-a-orm';
|
|
5
5
|
import { Dto } from 'vona-module-a-web';
|
|
6
6
|
import { ModelRecord } from 'vona-module-training-record';
|
|
@@ -16,23 +16,43 @@ export interface IDtoOptionsDetailRecordResItem extends IDecoratorDtoOptions {}
|
|
|
16
16
|
ZovaRender.block('basic-details:blockDetails', {
|
|
17
17
|
blocks: [
|
|
18
18
|
ZovaRender.block('basic-details:blockToolbarBulk', {
|
|
19
|
-
actions: [
|
|
19
|
+
actions: [
|
|
20
|
+
ZovaRender.detailsActionBulk('basic-details:actionCreate', {
|
|
21
|
+
dialogOptions: { title: $locale('AddTrainingRecord') },
|
|
22
|
+
permission: { formScene: ['create', 'edit'] },
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
20
25
|
}),
|
|
21
26
|
ZovaRender.block('basic-details:blockTable'),
|
|
22
27
|
],
|
|
23
28
|
}),
|
|
24
29
|
],
|
|
30
|
+
fields: {
|
|
31
|
+
name: $makeMetadata(
|
|
32
|
+
ZovaRender.cell('basic-details:actionView', {
|
|
33
|
+
dialogOptions: { title: $locale('ViewTrainingRecord') },
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
},
|
|
25
37
|
})
|
|
26
38
|
export class DtoDetailRecordResItem extends $Dto.get(() => ModelRecord, {
|
|
27
39
|
dtoClass: DtoDetailRecordBase,
|
|
28
40
|
}) {
|
|
41
|
+
@Api.field(v.title('#'), ZovaRender.order(1, 'core'), ZovaRender.cell('basic-details:lineNumber'))
|
|
42
|
+
_lineNumber?: number;
|
|
43
|
+
|
|
29
44
|
@Api.field(
|
|
30
45
|
v.title($locale('Operations')),
|
|
31
46
|
ZovaRender.order(1, 'max'),
|
|
32
|
-
ZovaRender.cell('basic-
|
|
47
|
+
ZovaRender.cell('basic-details:actionOperationsRow', {
|
|
33
48
|
actions: [
|
|
34
|
-
ZovaRender.
|
|
35
|
-
|
|
49
|
+
ZovaRender.detailsActionRow('basic-details:actionUpdate', {
|
|
50
|
+
dialogOptions: { title: $locale('EditTrainingRecord') },
|
|
51
|
+
permission: { formScene: ['create', 'edit'] },
|
|
52
|
+
}),
|
|
53
|
+
ZovaRender.detailsActionRow('basic-details:actionDelete', {
|
|
54
|
+
permission: { formScene: ['create', 'edit'] },
|
|
55
|
+
}),
|
|
36
56
|
],
|
|
37
57
|
}),
|
|
38
58
|
)
|
|
@@ -10,18 +10,7 @@ import { DtoDetailRecordBase } from './detailRecordBase.tsx';
|
|
|
10
10
|
export interface IDtoOptionsDetailRecordView extends IDecoratorDtoOptions {}
|
|
11
11
|
|
|
12
12
|
@Dto<IDtoOptionsDetailRecordView>({
|
|
13
|
-
blocks: [
|
|
14
|
-
ZovaRender.block('basic-pageentry:blockPageEntry', {
|
|
15
|
-
blocks: [
|
|
16
|
-
ZovaRender.block('basic-pageentry:blockForm'),
|
|
17
|
-
ZovaRender.block('basic-pageentry:blockToolbarRow', {
|
|
18
|
-
actions: [
|
|
19
|
-
ZovaRender.formActionRow('basic-form:actionBack', { permission: { public: true } }),
|
|
20
|
-
],
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
}),
|
|
24
|
-
],
|
|
13
|
+
blocks: [ZovaRender.block('basic-details:blockForm')],
|
|
25
14
|
})
|
|
26
15
|
export class DtoDetailRecordView extends $Dto.get(() => ModelRecord, {
|
|
27
16
|
dtoClass: DtoDetailRecordBase,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
|
|
3
|
-
import { $
|
|
3
|
+
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
4
4
|
import { $Dto } from 'vona-module-a-orm';
|
|
5
5
|
import { Dto } from 'vona-module-a-web';
|
|
6
6
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
@@ -29,15 +29,17 @@ export interface IDtoOptionsStudentCreate extends IDecoratorDtoOptions {}
|
|
|
29
29
|
}),
|
|
30
30
|
],
|
|
31
31
|
fields: {
|
|
32
|
-
trainingRecords: $
|
|
32
|
+
trainingRecords: $makeMetadata(
|
|
33
33
|
v.title($locale('TrainingRecords')),
|
|
34
34
|
ZovaRender.order(5),
|
|
35
35
|
ZovaRender.field('basic-details:formFieldDetails'),
|
|
36
36
|
v.optional(),
|
|
37
|
-
v.array(DtoDetailRecordResItem),
|
|
38
37
|
),
|
|
39
38
|
},
|
|
40
39
|
})
|
|
41
40
|
export class DtoStudentCreate extends $Dto.create(() => ModelStudent, {
|
|
42
41
|
include: { trainingRecords: { dtoClass: DtoDetailRecordMutate } },
|
|
43
|
-
}) {
|
|
42
|
+
}) {
|
|
43
|
+
@Api.field(ZovaRender.visible(false), v.optional(), v.array(DtoDetailRecordResItem))
|
|
44
|
+
_trainingRecords?: DtoDetailRecordResItem[];
|
|
45
|
+
}
|
|
@@ -7,7 +7,7 @@ import z from 'zod';
|
|
|
7
7
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
8
8
|
|
|
9
9
|
import { $locale } from '../.metadata/locales.ts';
|
|
10
|
-
import { EntityStudent, studentLevelItems
|
|
10
|
+
import { EntityStudent, studentLevelItems } from '../entity/student.tsx';
|
|
11
11
|
|
|
12
12
|
export interface IDtoOptionsStudentSelectReq extends IDecoratorDtoOptions {}
|
|
13
13
|
|
|
@@ -17,17 +17,14 @@ export interface IDtoOptionsStudentSelectReq extends IDecoratorDtoOptions {}
|
|
|
17
17
|
name: $makeSchema(v.optional(), z.string()),
|
|
18
18
|
level: $makeSchema(
|
|
19
19
|
v.title($locale('Level')),
|
|
20
|
-
v.optional(),
|
|
21
20
|
ZovaRender.field('basic-select:formFieldSelect', {
|
|
22
21
|
items: studentLevelItems,
|
|
23
22
|
// Keep placeholder undefined so the filter select gets a real empty option
|
|
24
23
|
// instead of a disabled placeholder, allowing users to clear the filter.
|
|
25
24
|
placeholder: undefined,
|
|
26
25
|
}),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return value;
|
|
30
|
-
}, studentLevelSchema),
|
|
26
|
+
v.optional(),
|
|
27
|
+
z.number(),
|
|
31
28
|
),
|
|
32
29
|
createdAt: $makeSchema(
|
|
33
30
|
ZovaRender.field('basic-date:formFieldDateRange'),
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
|
|
3
|
+
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
3
4
|
import { $Dto } from 'vona-module-a-orm';
|
|
4
5
|
import { Dto } from 'vona-module-a-web';
|
|
5
6
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
6
7
|
|
|
8
|
+
import { $locale } from '../.metadata/locales.ts';
|
|
7
9
|
import { ModelStudent } from '../model/student.ts';
|
|
8
10
|
import { DtoDetailRecordMutate } from './detailRecordMutate.tsx';
|
|
11
|
+
import { DtoDetailRecordResItem } from './detailRecordResItem.tsx';
|
|
9
12
|
|
|
10
13
|
export interface IDtoOptionsStudentUpdate extends IDecoratorDtoOptions {}
|
|
11
14
|
|
|
@@ -25,7 +28,17 @@ export interface IDtoOptionsStudentUpdate extends IDecoratorDtoOptions {}
|
|
|
25
28
|
],
|
|
26
29
|
}),
|
|
27
30
|
],
|
|
31
|
+
fields: {
|
|
32
|
+
trainingRecords: $makeMetadata(
|
|
33
|
+
v.title($locale('TrainingRecords')),
|
|
34
|
+
ZovaRender.order(5),
|
|
35
|
+
ZovaRender.field('basic-details:formFieldDetails'),
|
|
36
|
+
),
|
|
37
|
+
},
|
|
28
38
|
})
|
|
29
39
|
export class DtoStudentUpdate extends $Dto.update(() => ModelStudent, {
|
|
30
40
|
include: { trainingRecords: { dtoClass: DtoDetailRecordMutate } },
|
|
31
|
-
}) {
|
|
41
|
+
}) {
|
|
42
|
+
@Api.field(ZovaRender.visible(false), v.optional(), v.array(DtoDetailRecordResItem))
|
|
43
|
+
_trainingRecords?: DtoDetailRecordResItem[];
|
|
44
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
2
|
|
|
3
|
+
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
3
4
|
import { $Dto } from 'vona-module-a-orm';
|
|
4
5
|
import { Dto } from 'vona-module-a-web';
|
|
5
6
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
6
7
|
|
|
8
|
+
import { $locale } from '../.metadata/locales.ts';
|
|
7
9
|
import { ModelStudent } from '../model/student.ts';
|
|
10
|
+
import { DtoDetailRecordResItem } from './detailRecordResItem.tsx';
|
|
8
11
|
import { DtoDetailRecordView } from './detailRecordView.tsx';
|
|
9
12
|
|
|
10
13
|
export interface IDtoOptionsStudentView extends IDecoratorDtoOptions {}
|
|
@@ -22,7 +25,17 @@ export interface IDtoOptionsStudentView extends IDecoratorDtoOptions {}
|
|
|
22
25
|
],
|
|
23
26
|
}),
|
|
24
27
|
],
|
|
28
|
+
fields: {
|
|
29
|
+
trainingRecords: $makeMetadata(
|
|
30
|
+
v.title($locale('TrainingRecords')),
|
|
31
|
+
ZovaRender.order(5),
|
|
32
|
+
ZovaRender.field('basic-details:formFieldDetails'),
|
|
33
|
+
),
|
|
34
|
+
},
|
|
25
35
|
})
|
|
26
36
|
export class DtoStudentView extends $Dto.get(() => ModelStudent, {
|
|
27
37
|
include: { trainingRecords: { dtoClass: DtoDetailRecordView } },
|
|
28
|
-
}) {
|
|
38
|
+
}) {
|
|
39
|
+
@Api.field(ZovaRender.visible(false), v.optional(), v.array(DtoDetailRecordResItem))
|
|
40
|
+
_trainingRecords?: DtoDetailRecordResItem[];
|
|
41
|
+
}
|
|
@@ -2,13 +2,10 @@ import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
|
2
2
|
|
|
3
3
|
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
4
4
|
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
5
|
-
import z from 'zod';
|
|
6
5
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
7
6
|
|
|
8
7
|
import { $locale } from '../.metadata/locales.ts';
|
|
9
8
|
|
|
10
|
-
export const studentLevelSchema = z.union([z.literal(1), z.literal(2), z.literal(3)]);
|
|
11
|
-
|
|
12
9
|
export const studentLevelItems = [
|
|
13
10
|
{ value: 1, title: $locale('LevelBeginner') },
|
|
14
11
|
{ value: 2, title: $locale('LevelIntermediate') },
|
|
@@ -78,7 +75,6 @@ export class EntityStudent extends EntityBase {
|
|
|
78
75
|
}),
|
|
79
76
|
// Tutorial 4 custom table cell renderer example used by the current implementation.
|
|
80
77
|
ZovaRender.cell('training-student:level', { items: studentLevelItems }),
|
|
81
|
-
studentLevelSchema,
|
|
82
78
|
)
|
|
83
|
-
level:
|
|
79
|
+
level: number;
|
|
84
80
|
}
|
|
@@ -15,7 +15,7 @@ import type { ModelStudent } from '../model/student.ts';
|
|
|
15
15
|
@Service()
|
|
16
16
|
export class ServiceStudent extends BeanBase {
|
|
17
17
|
async create(student: DtoStudentCreate): Promise<EntityStudent> {
|
|
18
|
-
return await this.scope.model.student.insert(student);
|
|
18
|
+
return await this.scope.model.student.insert(student, { include: { trainingRecords: true } });
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async select(params?: IQueryParams<ModelStudent>): Promise<DtoStudentSelectRes> {
|
|
@@ -27,7 +27,9 @@ export class ServiceStudent extends BeanBase {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async update(id: TableIdentity, student: DtoStudentUpdate) {
|
|
30
|
-
return await this.scope.model.student.updateById(id, student
|
|
30
|
+
return await this.scope.model.student.updateById(id, student, {
|
|
31
|
+
include: { trainingRecords: true },
|
|
32
|
+
});
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
async summary(id: TableIdentity): Promise<DtoStudentSummary | undefined> {
|
|
@@ -48,10 +50,13 @@ export class ServiceStudent extends BeanBase {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
async delete(id: TableIdentity) {
|
|
51
|
-
return await this.scope.model.student.deleteById(id);
|
|
53
|
+
return await this.scope.model.student.deleteById(id, { include: { trainingRecords: true } });
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
async deleteForce(id: TableIdentity) {
|
|
55
|
-
return await this.scope.model.student.deleteById(id, {
|
|
57
|
+
return await this.scope.model.student.deleteById(id, {
|
|
58
|
+
disableDeleted: true,
|
|
59
|
+
include: { trainingRecords: true },
|
|
60
|
+
});
|
|
56
61
|
}
|
|
57
62
|
}
|