vona-module-test-vona 5.0.51 → 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 +33 -10
- package/dist/controller/order.d.ts +63 -0
- package/dist/dto/orderQueryPage.d.ts +9 -0
- package/dist/dto/orderResultPage.d.ts +8 -0
- package/dist/dto/serializerTest.d.ts +6 -0
- package/dist/index.js +406 -347
- package/package.json +1 -1
- package/src/.metadata/index.ts +36 -10
- package/src/controller/order.ts +26 -1
- package/src/dto/orderCreate.ts +1 -2
- package/src/dto/orderQueryPage.ts +20 -0
- package/src/dto/orderResultPage.ts +9 -0
- 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
|
}
|
|
@@ -1331,13 +1331,16 @@ export interface IModuleSummerCache {
|
|
|
1331
1331
|
export * from '../dto/categoryTree.ts';
|
|
1332
1332
|
export * from '../dto/orderCreate.ts';
|
|
1333
1333
|
export * from '../dto/orderQuery.ts';
|
|
1334
|
+
export * from '../dto/orderQueryPage.ts';
|
|
1334
1335
|
export * from '../dto/orderResult.ts';
|
|
1336
|
+
export * from '../dto/orderResultPage.ts';
|
|
1335
1337
|
export * from '../dto/orderUpdate.ts';
|
|
1336
1338
|
export * from '../dto/postCreate.ts';
|
|
1337
1339
|
export * from '../dto/postQuery.ts';
|
|
1338
1340
|
export * from '../dto/postQueryRes.ts';
|
|
1339
1341
|
export * from '../dto/profile.ts';
|
|
1340
1342
|
export * from '../dto/roleLazy.ts';
|
|
1343
|
+
export * from '../dto/serializerTest.ts';
|
|
1341
1344
|
export * from '../dto/signin.ts';
|
|
1342
1345
|
export * from '../dto/user.ts';
|
|
1343
1346
|
export * from '../dto/userCreate.ts';
|
|
@@ -1346,13 +1349,16 @@ export * from '../dto/userUpdate.ts';
|
|
|
1346
1349
|
import type { IDtoOptionsCategoryTree } from '../dto/categoryTree.ts';
|
|
1347
1350
|
import type { IDtoOptionsOrderCreate } from '../dto/orderCreate.ts';
|
|
1348
1351
|
import type { IDtoOptionsOrderQuery } from '../dto/orderQuery.ts';
|
|
1352
|
+
import type { IDtoOptionsOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
1349
1353
|
import type { IDtoOptionsOrderResult } from '../dto/orderResult.ts';
|
|
1354
|
+
import type { IDtoOptionsOrderResultPage } from '../dto/orderResultPage.ts';
|
|
1350
1355
|
import type { IDtoOptionsOrderUpdate } from '../dto/orderUpdate.ts';
|
|
1351
1356
|
import type { IDtoOptionsPostCreate } from '../dto/postCreate.ts';
|
|
1352
1357
|
import type { IDtoOptionsPostQuery } from '../dto/postQuery.ts';
|
|
1353
1358
|
import type { IDtoOptionsPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1354
1359
|
import type { IDtoOptionsProfile } from '../dto/profile.ts';
|
|
1355
1360
|
import type { IDtoOptionsRoleLazy } from '../dto/roleLazy.ts';
|
|
1361
|
+
import type { IDtoOptionsSerializerTest } from '../dto/serializerTest.ts';
|
|
1356
1362
|
import type { IDtoOptionsSignin } from '../dto/signin.ts';
|
|
1357
1363
|
import type { IDtoOptionsUser } from '../dto/user.ts';
|
|
1358
1364
|
import type { IDtoOptionsUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1365,13 +1371,16 @@ declare module 'vona-module-a-web' {
|
|
|
1365
1371
|
'test-vona:categoryTree': IDtoOptionsCategoryTree;
|
|
1366
1372
|
'test-vona:orderCreate': IDtoOptionsOrderCreate;
|
|
1367
1373
|
'test-vona:orderQuery': IDtoOptionsOrderQuery;
|
|
1374
|
+
'test-vona:orderQueryPage': IDtoOptionsOrderQueryPage;
|
|
1368
1375
|
'test-vona:orderResult': IDtoOptionsOrderResult;
|
|
1376
|
+
'test-vona:orderResultPage': IDtoOptionsOrderResultPage;
|
|
1369
1377
|
'test-vona:orderUpdate': IDtoOptionsOrderUpdate;
|
|
1370
1378
|
'test-vona:postCreate': IDtoOptionsPostCreate;
|
|
1371
1379
|
'test-vona:postQuery': IDtoOptionsPostQuery;
|
|
1372
1380
|
'test-vona:postQueryRes': IDtoOptionsPostQueryRes;
|
|
1373
1381
|
'test-vona:profile': IDtoOptionsProfile;
|
|
1374
1382
|
'test-vona:roleLazy': IDtoOptionsRoleLazy;
|
|
1383
|
+
'test-vona:serializerTest': IDtoOptionsSerializerTest;
|
|
1375
1384
|
'test-vona:signin': IDtoOptionsSignin;
|
|
1376
1385
|
'test-vona:user': IDtoOptionsUser;
|
|
1377
1386
|
'test-vona:userCreate': IDtoOptionsUserCreate;
|
|
@@ -1389,13 +1398,16 @@ declare module 'vona-module-test-vona' {
|
|
|
1389
1398
|
import type { DtoCategoryTree } from '../dto/categoryTree.ts';
|
|
1390
1399
|
import type { DtoOrderCreate } from '../dto/orderCreate.ts';
|
|
1391
1400
|
import type { DtoOrderQuery } from '../dto/orderQuery.ts';
|
|
1401
|
+
import type { DtoOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
1392
1402
|
import type { DtoOrderResult } from '../dto/orderResult.ts';
|
|
1403
|
+
import type { DtoOrderResultPage } from '../dto/orderResultPage.ts';
|
|
1393
1404
|
import type { DtoOrderUpdate } from '../dto/orderUpdate.ts';
|
|
1394
1405
|
import type { DtoPostCreate } from '../dto/postCreate.ts';
|
|
1395
1406
|
import type { DtoPostQuery } from '../dto/postQuery.ts';
|
|
1396
1407
|
import type { DtoPostQueryRes } from '../dto/postQueryRes.ts';
|
|
1397
1408
|
import type { DtoProfile } from '../dto/profile.ts';
|
|
1398
1409
|
import type { DtoRoleLazy } from '../dto/roleLazy.ts';
|
|
1410
|
+
import type { DtoSerializerTest } from '../dto/serializerTest.ts';
|
|
1399
1411
|
import type { DtoSignin } from '../dto/signin.ts';
|
|
1400
1412
|
import type { DtoUser } from '../dto/user.ts';
|
|
1401
1413
|
import type { DtoUserCreate } from '../dto/userCreate.ts';
|
|
@@ -1415,10 +1427,18 @@ declare module 'vona-module-test-vona' {
|
|
|
1415
1427
|
fields?: TypeEntityOptionsFields<DtoOrderQuery, IDtoOptionsOrderQuery[TypeSymbolKeyFieldsMore]>;
|
|
1416
1428
|
}
|
|
1417
1429
|
|
|
1430
|
+
export interface IDtoOptionsOrderQueryPage {
|
|
1431
|
+
fields?: TypeEntityOptionsFields<DtoOrderQueryPage, IDtoOptionsOrderQueryPage[TypeSymbolKeyFieldsMore]>;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1418
1434
|
export interface IDtoOptionsOrderResult {
|
|
1419
1435
|
fields?: TypeEntityOptionsFields<DtoOrderResult, IDtoOptionsOrderResult[TypeSymbolKeyFieldsMore]>;
|
|
1420
1436
|
}
|
|
1421
1437
|
|
|
1438
|
+
export interface IDtoOptionsOrderResultPage {
|
|
1439
|
+
fields?: TypeEntityOptionsFields<DtoOrderResultPage, IDtoOptionsOrderResultPage[TypeSymbolKeyFieldsMore]>;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1422
1442
|
export interface IDtoOptionsOrderUpdate {
|
|
1423
1443
|
fields?: TypeEntityOptionsFields<DtoOrderUpdate, IDtoOptionsOrderUpdate[TypeSymbolKeyFieldsMore]>;
|
|
1424
1444
|
}
|
|
@@ -1443,6 +1463,10 @@ declare module 'vona-module-test-vona' {
|
|
|
1443
1463
|
fields?: TypeEntityOptionsFields<DtoRoleLazy, IDtoOptionsRoleLazy[TypeSymbolKeyFieldsMore]>;
|
|
1444
1464
|
}
|
|
1445
1465
|
|
|
1466
|
+
export interface IDtoOptionsSerializerTest {
|
|
1467
|
+
fields?: TypeEntityOptionsFields<DtoSerializerTest, IDtoOptionsSerializerTest[TypeSymbolKeyFieldsMore]>;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1446
1470
|
export interface IDtoOptionsSignin {
|
|
1447
1471
|
fields?: TypeEntityOptionsFields<DtoSignin, IDtoOptionsSignin[TypeSymbolKeyFieldsMore]>;
|
|
1448
1472
|
}
|
|
@@ -1802,6 +1826,7 @@ declare module 'vona-module-a-web' {
|
|
|
1802
1826
|
'/test/vona/onion/echo5': undefined;
|
|
1803
1827
|
'/test/vona/onion/echo6': undefined;
|
|
1804
1828
|
'/test/vona/order/findAll': undefined;
|
|
1829
|
+
'/test/vona/order/findMany': undefined;
|
|
1805
1830
|
'/test/vona/passport/echo/:name': undefined;
|
|
1806
1831
|
'/test/vona/passport/isAuthenticated': undefined;
|
|
1807
1832
|
'/test/vona/post/findManyEcho': undefined;
|
|
@@ -1816,6 +1841,7 @@ export interface IApiPathPostRecord{
|
|
|
1816
1841
|
'/test/vona/onion/echo2/:userId/:userName': undefined;
|
|
1817
1842
|
'/test/vona/onion/echo4': undefined;
|
|
1818
1843
|
'/test/vona/order/create': undefined;
|
|
1844
|
+
'/test/vona/order/update/:id': undefined;
|
|
1819
1845
|
'/test/vona/passport/login': undefined;
|
|
1820
1846
|
'/test/vona/passport/refresh': undefined;
|
|
1821
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';
|
|
@@ -7,7 +8,10 @@ import { Api, v } from 'vona-module-a-openapi';
|
|
|
7
8
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
8
9
|
import { DtoOrderCreate } from '../dto/orderCreate.ts';
|
|
9
10
|
import { DtoOrderQuery } from '../dto/orderQuery.ts';
|
|
11
|
+
import { DtoOrderQueryPage } from '../dto/orderQueryPage.ts';
|
|
10
12
|
import { DtoOrderResult } from '../dto/orderResult.ts';
|
|
13
|
+
import { DtoOrderResultPage } from '../dto/orderResultPage.ts';
|
|
14
|
+
import { DtoOrderUpdate } from '../dto/orderUpdate.ts';
|
|
11
15
|
|
|
12
16
|
export interface IControllerOptionsOrder extends IDecoratorControllerOptions {}
|
|
13
17
|
|
|
@@ -23,10 +27,18 @@ function myCustomQueryTransform(_ctx: VonaContext, info: IPipeOptionsQueryTransf
|
|
|
23
27
|
export class ControllerOrder extends BeanBase {
|
|
24
28
|
@Web.post('create')
|
|
25
29
|
@Api.body(DtoOrderResult)
|
|
26
|
-
async create(@Arg.body(
|
|
30
|
+
async create(@Arg.body() data: DtoOrderCreate) {
|
|
27
31
|
return await this.scope.model.order.insert(data);
|
|
28
32
|
}
|
|
29
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
|
+
|
|
30
42
|
@Web.get('findAll')
|
|
31
43
|
@Api.body(v.array(DtoOrderResult))
|
|
32
44
|
async findAll(
|
|
@@ -39,4 +51,17 @@ export class ControllerOrder extends BeanBase {
|
|
|
39
51
|
},
|
|
40
52
|
});
|
|
41
53
|
}
|
|
54
|
+
|
|
55
|
+
@Web.get('findMany')
|
|
56
|
+
@Api.body(DtoOrderResultPage)
|
|
57
|
+
async findMany(
|
|
58
|
+
@Arg.queryPro(DtoOrderQueryPage) params: IQueryParams<ModelOrder>,
|
|
59
|
+
) {
|
|
60
|
+
return this.scope.model.order.selectAndCount({
|
|
61
|
+
...params,
|
|
62
|
+
include: {
|
|
63
|
+
products: true,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
42
67
|
}
|
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,20 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { $Class } from 'vona';
|
|
3
|
+
import { Api } from 'vona-module-a-openapi';
|
|
4
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
import { EntityOrder } from '../entity/order.ts';
|
|
8
|
+
|
|
9
|
+
export interface IDtoOptionsOrderQueryPage extends IDecoratorDtoOptions {}
|
|
10
|
+
|
|
11
|
+
@Dto<IDtoOptionsOrderQueryPage>({
|
|
12
|
+
fields: {
|
|
13
|
+
pageSize: z.number().min(1).max(300).default(30),
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
export class DtoOrderQueryPage
|
|
17
|
+
extends $Class.omit($Dto.queryPage(EntityOrder, ['orderNo', 'remark']), ['pageSize']) {
|
|
18
|
+
@Api.field(z.number().min(1).max(300).default(30))
|
|
19
|
+
pageSize: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
3
|
+
import { Dto } from 'vona-module-a-web';
|
|
4
|
+
import { ModelOrder } from 'vona-module-test-vona';
|
|
5
|
+
|
|
6
|
+
export interface IDtoOptionsOrderResultPage extends IDecoratorDtoOptions {}
|
|
7
|
+
|
|
8
|
+
@Dto<IDtoOptionsOrderResultPage>()
|
|
9
|
+
export class DtoOrderResultPage extends $Dto.selectAndCount(() => ModelOrder) {}
|
|
@@ -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
|
+
}
|