cabloy 5.1.248 → 5.1.250
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/.cabloy-version +1 -1
- package/.github/workflows/create-cabloy.yml +50 -3
- package/.vscode/settings.json +1 -2
- package/CHANGELOG.md +31 -0
- package/package.json +1 -7
- package/repo-agent-governance/managed-assets.json +12 -12
- package/repo-agent-governance/skills/cabloy-spec-execution/references/status-and-evidence.md +1 -1
- package/repo-agent-governance/skills/cabloy-spec-generation/references/canonical-spec-input.md +1 -1
- package/repo-agent-governance/skills/cabloy-spec-generation/references/repo-specs-document-set.md +2 -2
- package/repo-agent-governance/skills/cabloy-spec-generation/references/traceability-and-status-rules.md +1 -1
- package/repo-agent-governance/tools/spec-charts/generate-implementation-charts.mjs +73 -22
- package/repo-agent-governance/tools/spec-charts/generate-implementation-charts.test.mjs +98 -7
- package/repo-docs/ai/playbook-spec-execution.md +1 -1
- package/repo-docs/backend/crud-workflow.md +92 -1
- package/repo-docs/backend/dto-guide.md +16 -1
- package/repo-docs/backend/dto-infer-generation.md +23 -5
- package/repo-docs/backend/orm-aggregate-group-guide.md +32 -0
- package/repo-docs/backend/validation-guide.md +38 -2
- package/repo-e2e/specs/cabloy-basic.spec.ts +9 -2
- package/vona/package.original.json +1 -7
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/aggregate/src/dto/{{resourceName}}AggregateRes.tsx_ +11 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/common/src/lib/{{resourceName}}Analysis.ts_ +14 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/common/test/{{resourceName}}Analysis.test.ts_ +81 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudAnalysis/group/src/dto/{{resourceName}}GroupResItem.tsx_ +11 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/controller/{{resourceName}}.ts_ +18 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/dto/{{resourceName}}SelectReq.tsx_ +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/src/service/{{resourceName}}.ts_ +14 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/boilerplate/test/{{resourceName}}.test.ts_ +4 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/4-zh-cn.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/controller/{{resourceName}}.ts_ +18 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/dto/{{resourceName}}SelectReq.tsx_ +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/src/service/{{resourceName}}.ts_ +14 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/boilerplate/test/{{resourceName}}.test.ts_ +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +2 -0
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/4-zh-cn.ts +2 -0
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudBasic.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudStart.ts +2 -0
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.masterDetail.ts +9 -1
- package/vona/packages-cli/cli-set-api/src/lib/crudAnalysis.ts +11 -0
- package/vona/packages-cli/cli-set-api/test/crudAnalysis.test.ts +385 -0
- package/vona/packages-utils/babel-plugin-vona-bean-module/package.json +1 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +76 -1008
- package/vona/src/suite/a-training/modules/training-student/src/.metadata/index.ts +18 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/en-us.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/config/locale/zh-cn.ts +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/controller/student.ts +28 -1
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentAggregateRes.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentGroupResItem.tsx +11 -0
- package/vona/src/suite/a-training/modules/training-student/src/dto/studentSelectReq.tsx +2 -0
- package/vona/src/suite/a-training/modules/training-student/src/lib/studentAnalysis.ts +12 -0
- package/vona/src/suite/a-training/modules/training-student/src/service/student.ts +22 -1
- package/vona/src/suite/a-training/modules/training-student/test/student.test.ts +4 -0
- package/vona/src/suite/a-training/modules/training-student/test/studentAnalysis.test.ts +422 -0
- package/vona/src/suite-vendor/a-cabloy/modules/a-rbac/package.json +1 -1
- package/vona/src/suite-vendor/a-cabloy/package.json +2 -2
- package/vona/src/suite-vendor/a-captcha/modules/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-captcha/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-hmr/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-locale/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-openapi/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/utils.ts +1 -1
- 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/.metadata/index.ts +26 -26
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/aggregateResult.ts +53 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/controls.ts +163 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/execute.ts +49 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/index.ts +3 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/analysis/policy.ts +140 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/bean.model/bean.model_cache.ts +4 -2
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/bean.model/bean.model_crud_inner.ts +8 -3
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dto.ts +3 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoAggregate.ts +4 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/dto/dtoAnalysis.ts +34 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/analysis.ts +137 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/src/types/relationsAggr.ts +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/aggregateResult.test.ts +81 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/analysis.test.ts +208 -0
- package/vona/src/suite-vendor/a-vona/modules/a-orm/test/analysis.types.test.ts +112 -0
- package/vona/src/suite-vendor/a-vona/modules/a-permission/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-queue/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-ratelimit/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-user/package.json +1 -1
- 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/.metadata/index.ts +40 -40
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/bean/pipe.filter.ts +44 -3
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/analysisFilter.ts +69 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/decorator/arguments.ts +6 -4
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/lib/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/types/dto.ts +2 -1
- package/vona/src/suite-vendor/a-vona/modules/a-web/src/types/filter.ts +7 -2
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/package.original.json +0 -6
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/package.json +2 -2
- package/zova/packages-utils/zova-jsx/package.json +2 -2
- package/zova/packages-utils/zova-vite/package.json +1 -1
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +1 -1
- package/zova/pnpm-lock.yaml +11 -963
- package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.header.tsx +4 -1
- package/zova/src/suite/a-home/modules/home-layoutadmin/src/component/layoutAdmin/render.tabs.tsx +2 -2
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/schemas.ts +16 -2
- package/zova/src/suite/a-training/modules/training-student/src/api/openapi/types.ts +201 -7
- package/zova/src/suite/a-training/modules/training-student/src/api/trainingStudent.ts +42 -0
- package/zova/src/suite/a-training/modules/training-student/src/apiSchema/trainingStudent.ts +10 -0
- package/zova/src/suite-vendor/a-zova/modules/a-ssr/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-ssrserver/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/package.json +5 -5
- package/vona/.textlintrc.json +0 -19
|
@@ -216,8 +216,10 @@ export * from '../dto/detailRecordBase.tsx';
|
|
|
216
216
|
export * from '../dto/detailRecordMutate.tsx';
|
|
217
217
|
export * from '../dto/detailRecordResItem.tsx';
|
|
218
218
|
export * from '../dto/detailRecordView.tsx';
|
|
219
|
+
export * from '../dto/studentAggregateRes.tsx';
|
|
219
220
|
export * from '../dto/studentCreate.tsx';
|
|
220
221
|
export * from '../dto/studentDeleteBulk.tsx';
|
|
222
|
+
export * from '../dto/studentGroupResItem.tsx';
|
|
221
223
|
export * from '../dto/studentSelectReq.tsx';
|
|
222
224
|
export * from '../dto/studentSelectRes.tsx';
|
|
223
225
|
export * from '../dto/studentSelectResItem.tsx';
|
|
@@ -228,8 +230,10 @@ import type { IDtoOptionsDetailRecordBase } from '../dto/detailRecordBase.tsx';
|
|
|
228
230
|
import type { IDtoOptionsDetailRecordMutate } from '../dto/detailRecordMutate.tsx';
|
|
229
231
|
import type { IDtoOptionsDetailRecordResItem } from '../dto/detailRecordResItem.tsx';
|
|
230
232
|
import type { IDtoOptionsDetailRecordView } from '../dto/detailRecordView.tsx';
|
|
233
|
+
import type { IDtoOptionsStudentAggregateRes } from '../dto/studentAggregateRes.tsx';
|
|
231
234
|
import type { IDtoOptionsStudentCreate } from '../dto/studentCreate.tsx';
|
|
232
235
|
import type { IDtoOptionsStudentDeleteBulk } from '../dto/studentDeleteBulk.tsx';
|
|
236
|
+
import type { IDtoOptionsStudentGroupResItem } from '../dto/studentGroupResItem.tsx';
|
|
233
237
|
import type { IDtoOptionsStudentSelectReq } from '../dto/studentSelectReq.tsx';
|
|
234
238
|
import type { IDtoOptionsStudentSelectRes } from '../dto/studentSelectRes.tsx';
|
|
235
239
|
import type { IDtoOptionsStudentSelectResItem } from '../dto/studentSelectResItem.tsx';
|
|
@@ -244,8 +248,10 @@ declare module 'vona-module-a-web' {
|
|
|
244
248
|
'training-student:detailRecordMutate': IDtoOptionsDetailRecordMutate;
|
|
245
249
|
'training-student:detailRecordResItem': IDtoOptionsDetailRecordResItem;
|
|
246
250
|
'training-student:detailRecordView': IDtoOptionsDetailRecordView;
|
|
251
|
+
'training-student:studentAggregateRes': IDtoOptionsStudentAggregateRes;
|
|
247
252
|
'training-student:studentCreate': IDtoOptionsStudentCreate;
|
|
248
253
|
'training-student:studentDeleteBulk': IDtoOptionsStudentDeleteBulk;
|
|
254
|
+
'training-student:studentGroupResItem': IDtoOptionsStudentGroupResItem;
|
|
249
255
|
'training-student:studentSelectReq': IDtoOptionsStudentSelectReq;
|
|
250
256
|
'training-student:studentSelectRes': IDtoOptionsStudentSelectRes;
|
|
251
257
|
'training-student:studentSelectResItem': IDtoOptionsStudentSelectResItem;
|
|
@@ -265,8 +271,10 @@ import type { DtoDetailRecordBase } from '../dto/detailRecordBase.tsx';
|
|
|
265
271
|
import type { DtoDetailRecordMutate } from '../dto/detailRecordMutate.tsx';
|
|
266
272
|
import type { DtoDetailRecordResItem } from '../dto/detailRecordResItem.tsx';
|
|
267
273
|
import type { DtoDetailRecordView } from '../dto/detailRecordView.tsx';
|
|
274
|
+
import type { DtoStudentAggregateRes } from '../dto/studentAggregateRes.tsx';
|
|
268
275
|
import type { DtoStudentCreate } from '../dto/studentCreate.tsx';
|
|
269
276
|
import type { DtoStudentDeleteBulk } from '../dto/studentDeleteBulk.tsx';
|
|
277
|
+
import type { DtoStudentGroupResItem } from '../dto/studentGroupResItem.tsx';
|
|
270
278
|
import type { DtoStudentSelectReq } from '../dto/studentSelectReq.tsx';
|
|
271
279
|
import type { DtoStudentSelectRes } from '../dto/studentSelectRes.tsx';
|
|
272
280
|
import type { DtoStudentSelectResItem } from '../dto/studentSelectResItem.tsx';
|
|
@@ -291,6 +299,10 @@ declare module 'vona-module-training-student' {
|
|
|
291
299
|
fields?: TypeEntityOptionsFields<DtoDetailRecordView, IDtoOptionsDetailRecordView[TypeSymbolKeyFieldsMore]>;
|
|
292
300
|
}
|
|
293
301
|
|
|
302
|
+
export interface IDtoOptionsStudentAggregateRes {
|
|
303
|
+
fields?: TypeEntityOptionsFields<DtoStudentAggregateRes, IDtoOptionsStudentAggregateRes[TypeSymbolKeyFieldsMore]>;
|
|
304
|
+
}
|
|
305
|
+
|
|
294
306
|
export interface IDtoOptionsStudentCreate {
|
|
295
307
|
fields?: TypeEntityOptionsFields<DtoStudentCreate, IDtoOptionsStudentCreate[TypeSymbolKeyFieldsMore]>;
|
|
296
308
|
}
|
|
@@ -299,6 +311,10 @@ declare module 'vona-module-training-student' {
|
|
|
299
311
|
fields?: TypeEntityOptionsFields<DtoStudentDeleteBulk, IDtoOptionsStudentDeleteBulk[TypeSymbolKeyFieldsMore]>;
|
|
300
312
|
}
|
|
301
313
|
|
|
314
|
+
export interface IDtoOptionsStudentGroupResItem {
|
|
315
|
+
fields?: TypeEntityOptionsFields<DtoStudentGroupResItem, IDtoOptionsStudentGroupResItem[TypeSymbolKeyFieldsMore]>;
|
|
316
|
+
}
|
|
317
|
+
|
|
302
318
|
export interface IDtoOptionsStudentSelectReq {
|
|
303
319
|
fields?: TypeEntityOptionsFields<DtoStudentSelectReq, IDtoOptionsStudentSelectReq[TypeSymbolKeyFieldsMore]>;
|
|
304
320
|
}
|
|
@@ -366,6 +382,8 @@ declare module 'vona-module-a-web' {
|
|
|
366
382
|
}
|
|
367
383
|
export interface IApiPathGetRecord{
|
|
368
384
|
'/training/student': undefined;
|
|
385
|
+
'/training/student/group': undefined;
|
|
386
|
+
'/training/student/aggregate': undefined;
|
|
369
387
|
'/training/student/:id': undefined;
|
|
370
388
|
'/training/student/summary/:id': undefined;
|
|
371
389
|
}
|
|
@@ -22,6 +22,8 @@ export default {
|
|
|
22
22
|
StudentController: 'Student Management',
|
|
23
23
|
StudentCreate: 'Create Student',
|
|
24
24
|
StudentSelect: 'List Students',
|
|
25
|
+
StudentGroup: 'Group Students',
|
|
26
|
+
StudentAggregate: 'Aggregate Students',
|
|
25
27
|
StudentView: 'View Student',
|
|
26
28
|
StudentUpdate: 'Update Student',
|
|
27
29
|
StudentSummary: 'View Student Summary',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IQueryParams,
|
|
4
|
+
TypeAnalysisAggregateParams,
|
|
5
|
+
TypeAnalysisGroupParams,
|
|
6
|
+
} from 'vona-module-a-orm';
|
|
3
7
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
4
8
|
|
|
5
9
|
import { BeanBase } from 'vona';
|
|
@@ -9,11 +13,14 @@ import { Passport } from 'vona-module-a-user';
|
|
|
9
13
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
10
14
|
import { z } from 'zod';
|
|
11
15
|
|
|
16
|
+
import type { studentAnalysis } from '../lib/studentAnalysis.ts';
|
|
12
17
|
import type { ModelStudent } from '../model/student.ts';
|
|
13
18
|
|
|
14
19
|
import { $locale } from '../.metadata/locales.ts';
|
|
20
|
+
import { DtoStudentAggregateRes } from '../dto/studentAggregateRes.tsx';
|
|
15
21
|
import { DtoStudentCreate } from '../dto/studentCreate.tsx';
|
|
16
22
|
import { DtoStudentDeleteBulk } from '../dto/studentDeleteBulk.tsx';
|
|
23
|
+
import { DtoStudentGroupResItem } from '../dto/studentGroupResItem.tsx';
|
|
17
24
|
import { DtoStudentSelectReq } from '../dto/studentSelectReq.tsx';
|
|
18
25
|
import { DtoStudentSelectRes } from '../dto/studentSelectRes.tsx';
|
|
19
26
|
import { DtoStudentSummary } from '../dto/studentSummary.tsx';
|
|
@@ -44,6 +51,26 @@ export class ControllerStudent extends BeanBase {
|
|
|
44
51
|
return await this.scope.service.student.select(params);
|
|
45
52
|
}
|
|
46
53
|
|
|
54
|
+
@Web.get('group', { summary: $locale('StudentGroup') })
|
|
55
|
+
@Api.body(v.array(DtoStudentGroupResItem))
|
|
56
|
+
@Passport.rbac({ actionInherit: 'select' })
|
|
57
|
+
async group(
|
|
58
|
+
@Arg.filter(DtoStudentSelectReq, { mode: 'group' })
|
|
59
|
+
params: TypeAnalysisGroupParams<typeof studentAnalysis>,
|
|
60
|
+
): Promise<DtoStudentGroupResItem[]> {
|
|
61
|
+
return await this.scope.service.student.group(params);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Web.get('aggregate', { summary: $locale('StudentAggregate') })
|
|
65
|
+
@Api.body(DtoStudentAggregateRes)
|
|
66
|
+
@Passport.rbac({ actionInherit: 'select' })
|
|
67
|
+
async aggregate(
|
|
68
|
+
@Arg.filter(DtoStudentSelectReq, { mode: 'aggregate' })
|
|
69
|
+
params: TypeAnalysisAggregateParams<typeof studentAnalysis>,
|
|
70
|
+
): Promise<DtoStudentAggregateRes> {
|
|
71
|
+
return await this.scope.service.student.aggregate(params);
|
|
72
|
+
}
|
|
73
|
+
|
|
47
74
|
@Web.get(':id', { summary: $locale('StudentView') })
|
|
48
75
|
@Api.body(v.optional(), v.object(DtoStudentView))
|
|
49
76
|
@Core.serializer()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
|
|
6
|
+
import { studentAnalysis } from '../lib/studentAnalysis.ts';
|
|
7
|
+
|
|
8
|
+
export interface IDtoOptionsStudentAggregateRes extends IDecoratorDtoOptions {}
|
|
9
|
+
|
|
10
|
+
@Dto<IDtoOptionsStudentAggregateRes>()
|
|
11
|
+
export class DtoStudentAggregateRes extends $Dto.analysisAggregate(studentAnalysis) {}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
|
|
6
|
+
import { studentAnalysis } from '../lib/studentAnalysis.ts';
|
|
7
|
+
|
|
8
|
+
export interface IDtoOptionsStudentGroupResItem extends IDecoratorDtoOptions {}
|
|
9
|
+
|
|
10
|
+
@Dto<IDtoOptionsStudentGroupResItem>()
|
|
11
|
+
export class DtoStudentGroupResItem extends $Dto.analysisGroup(studentAnalysis) {}
|
|
@@ -8,10 +8,12 @@ import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
|
8
8
|
|
|
9
9
|
import { $locale } from '../.metadata/locales.ts';
|
|
10
10
|
import { EntityStudent, studentLevelItems } from '../entity/student.tsx';
|
|
11
|
+
import { studentAnalysis } from '../lib/studentAnalysis.ts';
|
|
11
12
|
|
|
12
13
|
export interface IDtoOptionsStudentSelectReq extends IDecoratorDtoOptions {}
|
|
13
14
|
|
|
14
15
|
@Dto<IDtoOptionsStudentSelectReq>({
|
|
16
|
+
analysis: studentAnalysis,
|
|
15
17
|
openapi: { filter: { table: 'trainingStudent' } },
|
|
16
18
|
fields: {
|
|
17
19
|
name: $makeSchema(v.optional(), z.string()),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { $defineAnalysis } from 'vona-module-a-orm';
|
|
2
|
+
|
|
3
|
+
import { ModelStudent } from '../model/student.ts';
|
|
4
|
+
|
|
5
|
+
export const studentAnalysis = $defineAnalysis(() => ModelStudent, {
|
|
6
|
+
groups: ['level'],
|
|
7
|
+
aggrs: { count: ['*', 'imageId'] },
|
|
8
|
+
defaults: {
|
|
9
|
+
group: { groups: ['level'], aggrs: { count: ['*'] } },
|
|
10
|
+
aggregate: { aggrs: { count: ['*', 'imageId'] } },
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IQueryParams,
|
|
4
|
+
TypeAnalysisAggregateParams,
|
|
5
|
+
TypeAnalysisGroupParams,
|
|
6
|
+
} from 'vona-module-a-orm';
|
|
3
7
|
|
|
4
8
|
import { BeanBase } from 'vona';
|
|
5
9
|
import { Service } from 'vona-module-a-bean';
|
|
6
10
|
import { Core } from 'vona-module-a-core';
|
|
11
|
+
import { $executeAnalysisAggregate, $executeAnalysisGroup } from 'vona-module-a-orm';
|
|
7
12
|
|
|
13
|
+
import type { DtoStudentAggregateRes } from '../dto/studentAggregateRes.tsx';
|
|
8
14
|
import type { DtoStudentCreate } from '../dto/studentCreate.tsx';
|
|
15
|
+
import type { DtoStudentGroupResItem } from '../dto/studentGroupResItem.tsx';
|
|
9
16
|
import type { DtoStudentSelectRes } from '../dto/studentSelectRes.tsx';
|
|
10
17
|
import type { DtoStudentSummary } from '../dto/studentSummary.tsx';
|
|
11
18
|
import type { DtoStudentUpdate } from '../dto/studentUpdate.tsx';
|
|
@@ -13,6 +20,8 @@ import type { DtoStudentView } from '../dto/studentView.tsx';
|
|
|
13
20
|
import type { EntityStudent } from '../entity/student.tsx';
|
|
14
21
|
import type { ModelStudent } from '../model/student.ts';
|
|
15
22
|
|
|
23
|
+
import { studentAnalysis } from '../lib/studentAnalysis.ts';
|
|
24
|
+
|
|
16
25
|
type StudentContentInput = {
|
|
17
26
|
descriptionMarkdown?: string;
|
|
18
27
|
};
|
|
@@ -43,6 +52,18 @@ export class ServiceStudent extends BeanBase {
|
|
|
43
52
|
return await this.scope.model.student.selectAndCount(params);
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
async group(
|
|
56
|
+
params?: TypeAnalysisGroupParams<typeof studentAnalysis>,
|
|
57
|
+
): Promise<DtoStudentGroupResItem[]> {
|
|
58
|
+
return await $executeAnalysisGroup(this.scope.model.student, studentAnalysis, params);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async aggregate(
|
|
62
|
+
params?: TypeAnalysisAggregateParams<typeof studentAnalysis>,
|
|
63
|
+
): Promise<DtoStudentAggregateRes> {
|
|
64
|
+
return await $executeAnalysisAggregate(this.scope.model.student, studentAnalysis, params);
|
|
65
|
+
}
|
|
66
|
+
|
|
46
67
|
async view(id: TableIdentity): Promise<DtoStudentView | undefined> {
|
|
47
68
|
return await this.scope.model.student.getById(id, {
|
|
48
69
|
include: getStudentRelationsInclude(),
|
|
@@ -78,6 +78,8 @@ describe('student.test.ts', { concurrency: false }, () => {
|
|
|
78
78
|
const expectedSummaries = {
|
|
79
79
|
create: ['post', '/api/training/student', 'Create Student'],
|
|
80
80
|
select: ['get', '/api/training/student', 'List Students'],
|
|
81
|
+
group: ['get', '/api/training/student/group', 'Group Students'],
|
|
82
|
+
aggregate: ['get', '/api/training/student/aggregate', 'Aggregate Students'],
|
|
81
83
|
view: ['get', '/api/training/student/{id}', 'View Student'],
|
|
82
84
|
update: ['patch', '/api/training/student/{id}', 'Update Student'],
|
|
83
85
|
summary: ['get', '/api/training/student/summary/{id}', 'View Student Summary'],
|
|
@@ -685,6 +687,8 @@ describe('student.test.ts', { concurrency: false }, () => {
|
|
|
685
687
|
const expectedInherits = {
|
|
686
688
|
create: undefined,
|
|
687
689
|
select: undefined,
|
|
690
|
+
group: `${controllerBeanFullName}#select`,
|
|
691
|
+
aggregate: `${controllerBeanFullName}#select`,
|
|
688
692
|
view: undefined,
|
|
689
693
|
update: undefined,
|
|
690
694
|
summary: `${controllerBeanFullName}#view`,
|