vona-module-test-vona 5.0.52 → 5.0.53
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/.metadata/index.d.ts +18 -10
- package/dist/controller/order.d.ts +63 -2
- package/dist/dto/serializerTest.d.ts +6 -0
- package/dist/index.js +365 -340
- package/package.json +1 -1
- package/src/.metadata/index.ts +19 -10
- package/src/controller/order.ts +12 -2
- package/src/dto/orderCreate.ts +1 -2
- package/src/dto/serializerTest.ts +13 -0
package/package.json
CHANGED
package/src/.metadata/index.ts
CHANGED
|
@@ -451,7 +451,7 @@ import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'von
|
|
|
451
451
|
declare module 'vona-module-test-vona' {
|
|
452
452
|
export interface IModelOptionsCategory {
|
|
453
453
|
relations: {
|
|
454
|
-
children: IModelRelationHasMany<ModelCategory, true, 'id'|'name',undefined,undefined,undefined>;
|
|
454
|
+
children: IModelRelationHasMany<ModelCategory, 'categoryIdParent', true, 'id'|'name', undefined, undefined, undefined>;
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
457
|
export interface IModelOptionsCategoryChain {
|
|
@@ -462,24 +462,24 @@ export interface IModelOptionsCategoryChain {
|
|
|
462
462
|
export interface IModelOptionsOrder {
|
|
463
463
|
relations: {
|
|
464
464
|
user: IModelRelationBelongsTo<ModelOrder, ModelUser, true, 'id'|'name'>;
|
|
465
|
-
products: IModelRelationHasMany<ModelProduct, true, 'id'|'name'|'price'|'quantity'|'amount',undefined,undefined,undefined>;
|
|
465
|
+
products: IModelRelationHasMany<ModelProduct, 'orderId', true, 'id'|'name'|'price'|'quantity'|'amount', undefined, undefined, undefined>;
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
468
|
export interface IModelOptionsOrderStats {
|
|
469
469
|
relations: {
|
|
470
|
-
productStats: IModelRelationHasMany<ModelProduct, true,
|
|
471
|
-
productsGroups: IModelRelationHasMany<ModelProduct, false, undefined,undefined,{ count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> },'id' | Array<'id'>>;
|
|
470
|
+
productStats: IModelRelationHasMany<ModelProduct, 'orderId', true, undefined, undefined, { count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> }, undefined>;
|
|
471
|
+
productsGroups: IModelRelationHasMany<ModelProduct, 'orderId', false, undefined, undefined, { count?: '*' | Array<'*'>;sum?: 'amount' | Array<'amount'> }, 'id' | Array<'id'>>;
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
474
|
export interface IModelOptionsPost {
|
|
475
475
|
relations: {
|
|
476
|
-
postContent: IModelRelationHasOne<ModelPostContent, false, 'id'|'content'>;
|
|
476
|
+
postContent: IModelRelationHasOne<ModelPostContent, 'postId', false, 'id'|'content'>;
|
|
477
477
|
user: IModelRelationBelongsTo<ModelPost, ModelUser, true, 'id'|'name'>;
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
480
|
export interface IModelOptionsPostContent {
|
|
481
481
|
relations: {
|
|
482
|
-
post: IModelRelationBelongsTo<ModelPostContent, ModelPost, false,
|
|
482
|
+
post: IModelRelationBelongsTo<ModelPostContent, ModelPost, false, undefined>;
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
export interface IModelOptionsRole {
|
|
@@ -489,19 +489,19 @@ export interface IModelOptionsRole {
|
|
|
489
489
|
}
|
|
490
490
|
export interface IModelOptionsUser {
|
|
491
491
|
relations: {
|
|
492
|
-
posts: IModelRelationHasMany<ModelPost, false, 'id'|'title',['test-vona:user',ModelPostContent],undefined,undefined>;
|
|
492
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', false, 'id'|'title', ['test-vona:user',ModelPostContent], undefined, undefined>;
|
|
493
493
|
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, 'id'|'name',undefined,undefined,undefined>;
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
export interface IModelOptionsUserStats {
|
|
497
497
|
relations: {
|
|
498
|
-
posts: IModelRelationHasMany<ModelPost, true,
|
|
499
|
-
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false,
|
|
498
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', true, undefined, undefined, { count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> }, undefined>;
|
|
499
|
+
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, undefined,undefined,{ count?: '*' | Array<'*'> },undefined>;
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
502
|
export interface IModelOptionsUserStatsGroup {
|
|
503
503
|
relations: {
|
|
504
|
-
posts: IModelRelationHasMany<ModelPost, true, undefined,undefined,{ count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> },'title' | Array<'title'>>;
|
|
504
|
+
posts: IModelRelationHasMany<ModelPost, 'userId', true, undefined, undefined, { count?: '*'|'title' | Array<'*'|'title'>;sum?: 'stars' | Array<'stars'> }, 'title' | Array<'title'>>;
|
|
505
505
|
roles: IModelRelationBelongsToMany<'test-vona:roleUser', 'test-vona:role', false, undefined,undefined,{ count?: '*' | Array<'*'> },'name' | Array<'name'>>;
|
|
506
506
|
};
|
|
507
507
|
}
|
|
@@ -1340,6 +1340,7 @@ export * from '../dto/postQuery.ts';
|
|
|
1340
1340
|
export * from '../dto/postQueryRes.ts';
|
|
1341
1341
|
export * from '../dto/profile.ts';
|
|
1342
1342
|
export * from '../dto/roleLazy.ts';
|
|
1343
|
+
export * from '../dto/serializerTest.ts';
|
|
1343
1344
|
export * from '../dto/signin.ts';
|
|
1344
1345
|
export * from '../dto/user.ts';
|
|
1345
1346
|
export * from '../dto/userCreate.ts';
|
|
@@ -1357,6 +1358,7 @@ import type { IDtoOptionsPostQuery } from '../dto/postQuery.ts';
|
|
|
1357
1358
|
import type { IDtoOptionsPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1358
1359
|
import type { IDtoOptionsProfile } from '../dto/profile.ts';
|
|
1359
1360
|
import type { IDtoOptionsRoleLazy } from '../dto/roleLazy.ts';
|
|
1361
|
+
import type { IDtoOptionsSerializerTest } from '../dto/serializerTest.ts';
|
|
1360
1362
|
import type { IDtoOptionsSignin } from '../dto/signin.ts';
|
|
1361
1363
|
import type { IDtoOptionsUser } from '../dto/user.ts';
|
|
1362
1364
|
import type { IDtoOptionsUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1378,6 +1380,7 @@ declare module 'vona-module-a-web' {
|
|
|
1378
1380
|
'test-vona:postQueryRes': IDtoOptionsPostQueryRes;
|
|
1379
1381
|
'test-vona:profile': IDtoOptionsProfile;
|
|
1380
1382
|
'test-vona:roleLazy': IDtoOptionsRoleLazy;
|
|
1383
|
+
'test-vona:serializerTest': IDtoOptionsSerializerTest;
|
|
1381
1384
|
'test-vona:signin': IDtoOptionsSignin;
|
|
1382
1385
|
'test-vona:user': IDtoOptionsUser;
|
|
1383
1386
|
'test-vona:userCreate': IDtoOptionsUserCreate;
|
|
@@ -1404,6 +1407,7 @@ import type { DtoPostQuery } from '../dto/postQuery.ts';
|
|
|
1404
1407
|
import type { DtoPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1405
1408
|
import type { DtoProfile } from '../dto/profile.ts';
|
|
1406
1409
|
import type { DtoRoleLazy } from '../dto/roleLazy.ts';
|
|
1410
|
+
import type { DtoSerializerTest } from '../dto/serializerTest.ts';
|
|
1407
1411
|
import type { DtoSignin } from '../dto/signin.ts';
|
|
1408
1412
|
import type { DtoUser } from '../dto/user.ts';
|
|
1409
1413
|
import type { DtoUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1459,6 +1463,10 @@ declare module 'vona-module-test-vona' {
|
|
|
1459
1463
|
fields?: TypeEntityOptionsFields<DtoRoleLazy, IDtoOptionsRoleLazy[TypeSymbolKeyFieldsMore]>;
|
|
1460
1464
|
}
|
|
1461
1465
|
|
|
1466
|
+
export interface IDtoOptionsSerializerTest {
|
|
1467
|
+
fields?: TypeEntityOptionsFields<DtoSerializerTest, IDtoOptionsSerializerTest[TypeSymbolKeyFieldsMore]>;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1462
1470
|
export interface IDtoOptionsSignin {
|
|
1463
1471
|
fields?: TypeEntityOptionsFields<DtoSignin, IDtoOptionsSignin[TypeSymbolKeyFieldsMore]>;
|
|
1464
1472
|
}
|
|
@@ -1833,6 +1841,7 @@ export interface IApiPathPostRecord{
|
|
|
1833
1841
|
'/test/vona/onion/echo2/:userId/:userName': undefined;
|
|
1834
1842
|
'/test/vona/onion/echo4': undefined;
|
|
1835
1843
|
'/test/vona/order/create': undefined;
|
|
1844
|
+
'/test/vona/order/update/:id': undefined;
|
|
1836
1845
|
'/test/vona/passport/login': undefined;
|
|
1837
1846
|
'/test/vona/passport/refresh': undefined;
|
|
1838
1847
|
'/test/vona/passport/logout': undefined;
|
package/src/controller/order.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
1
2
|
import type { VonaContext } from 'vona';
|
|
2
3
|
import type { IQueryParams } from 'vona-module-a-orm';
|
|
3
4
|
import type { IDecoratorControllerOptions, IPipeOptionsQueryTransformInfo } from 'vona-module-a-web';
|
|
@@ -10,6 +11,7 @@ import { DtoOrderQuery } from '../dto/orderQuery.ts';
|
|
|
10
11
|
import { DtoOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
11
12
|
import { DtoOrderResult } from '../dto/orderResult.ts';
|
|
12
13
|
import { DtoOrderResultPage } from '../dto/orderResultPage.ts';
|
|
14
|
+
import { DtoOrderUpdate } from '../dto/orderUpdate.ts';
|
|
13
15
|
|
|
14
16
|
export interface IControllerOptionsOrder extends IDecoratorControllerOptions {}
|
|
15
17
|
|
|
@@ -25,10 +27,18 @@ function myCustomQueryTransform(_ctx: VonaContext, info: IPipeOptionsQueryTransf
|
|
|
25
27
|
export class ControllerOrder extends BeanBase {
|
|
26
28
|
@Web.post('create')
|
|
27
29
|
@Api.body(DtoOrderResult)
|
|
28
|
-
async create(@Arg.body(
|
|
30
|
+
async create(@Arg.body() data: DtoOrderCreate) {
|
|
29
31
|
return await this.scope.model.order.insert(data);
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
@Web.post('update/:id')
|
|
35
|
+
async update(@Arg.param('id') id: TableIdentity, @Arg.body() data: DtoOrderUpdate) {
|
|
36
|
+
return await this.scope.model.order.update({
|
|
37
|
+
...data,
|
|
38
|
+
id,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
@Web.get('findAll')
|
|
33
43
|
@Api.body(v.array(DtoOrderResult))
|
|
34
44
|
async findAll(
|
|
@@ -46,7 +56,7 @@ export class ControllerOrder extends BeanBase {
|
|
|
46
56
|
@Api.body(DtoOrderResultPage)
|
|
47
57
|
async findMany(
|
|
48
58
|
@Arg.queryPro(DtoOrderQueryPage) params: IQueryParams<ModelOrder>,
|
|
49
|
-
)
|
|
59
|
+
) {
|
|
50
60
|
return this.scope.model.order.selectAndCount({
|
|
51
61
|
...params,
|
|
52
62
|
include: {
|
package/src/dto/orderCreate.ts
CHANGED
|
@@ -6,5 +6,4 @@ import { ModelOrder } from '../model/order.ts';
|
|
|
6
6
|
export interface IDtoOptionsOrderCreate extends IDecoratorDtoOptions {}
|
|
7
7
|
|
|
8
8
|
@Dto<IDtoOptionsOrderCreate>()
|
|
9
|
-
export class DtoOrderCreate
|
|
10
|
-
extends $Dto.create(() => ModelOrder, { columns: ['orderNo', 'remark'] }) {}
|
|
9
|
+
export class DtoOrderCreate extends $Dto.create(() => ModelOrder, { columns: ['orderNo', 'remark'] }) {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { Api, v } from 'vona-module-a-openapi';
|
|
3
|
+
import { Serializer } from 'vona-module-a-serialization';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsSerializerTest extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsSerializerTest>()
|
|
9
|
+
export class DtoSerializerTest {
|
|
10
|
+
@Serializer.exclude()
|
|
11
|
+
@Api.field(v.min(6))
|
|
12
|
+
password: string;
|
|
13
|
+
}
|