vona-module-test-vona 5.0.66 → 5.0.68
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 +9 -9
- package/dist/index.js +12 -13
- package/package.json +1 -1
- package/src/.metadata/index.ts +9 -9
- package/src/controller/captcha.ts +2 -2
- package/src/controller/onion.ts +1 -2
- package/src/controller/transaction.ts +3 -3
- package/src/controller/upload.ts +5 -4
- package/src/service/post.ts +3 -2
- package/src/service/transaction.ts +3 -3
|
@@ -29,7 +29,7 @@ declare module 'vona-module-test-vona' {
|
|
|
29
29
|
/** aopMethod: begin */
|
|
30
30
|
export * from '../bean/aopMethod.test.ts';
|
|
31
31
|
import type { IAopMethodOptionsTest } from '../bean/aopMethod.test.ts';
|
|
32
|
-
import 'vona';
|
|
32
|
+
import 'vona-module-a-aspect';
|
|
33
33
|
declare module 'vona-module-a-aspect' {
|
|
34
34
|
interface IAopMethodRecord {
|
|
35
35
|
'test-vona:test': IAopMethodOptionsTest;
|
|
@@ -63,7 +63,7 @@ import type { IEntityOptionsRole } from '../entity/role.ts';
|
|
|
63
63
|
import type { IEntityOptionsRoleUser } from '../entity/roleUser.ts';
|
|
64
64
|
import type { IEntityOptionsTest } from '../entity/test.ts';
|
|
65
65
|
import type { IEntityOptionsUser } from '../entity/user.ts';
|
|
66
|
-
import 'vona';
|
|
66
|
+
import 'vona-module-a-orm';
|
|
67
67
|
declare module 'vona-module-a-orm' {
|
|
68
68
|
interface IEntityRecord {
|
|
69
69
|
'test-vona:category': IEntityOptionsCategory;
|
|
@@ -193,7 +193,7 @@ import type { IModelOptionsTestDynamicTable } from '../model/testDynamicTable.ts
|
|
|
193
193
|
import type { IModelOptionsUser } from '../model/user.ts';
|
|
194
194
|
import type { IModelOptionsUserStats } from '../model/userStats.ts';
|
|
195
195
|
import type { IModelOptionsUserStatsGroup } from '../model/userStatsGroup.ts';
|
|
196
|
-
import 'vona';
|
|
196
|
+
import 'vona-module-a-orm';
|
|
197
197
|
declare module 'vona-module-a-orm' {
|
|
198
198
|
interface IModelRecord {
|
|
199
199
|
'test-vona:category': IModelOptionsCategory;
|
|
@@ -831,7 +831,7 @@ export * from '../service/testClass.ts';
|
|
|
831
831
|
export * from '../service/testData.ts';
|
|
832
832
|
export * from '../service/transaction.ts';
|
|
833
833
|
export * from '../service/user.ts';
|
|
834
|
-
import 'vona';
|
|
834
|
+
import 'vona-module-a-bean';
|
|
835
835
|
declare module 'vona-module-a-bean' {
|
|
836
836
|
interface IServiceRecord {
|
|
837
837
|
'test-vona:aopMethod': never;
|
|
@@ -1097,8 +1097,8 @@ declare module 'vona-module-test-vona' {
|
|
|
1097
1097
|
/** eventListener: end */
|
|
1098
1098
|
/** meta: begin */
|
|
1099
1099
|
export * from '../bean/meta.version.ts';
|
|
1100
|
-
import 'vona';
|
|
1101
|
-
declare module 'vona' {
|
|
1100
|
+
import 'vona-module-a-meta';
|
|
1101
|
+
declare module 'vona-module-a-meta' {
|
|
1102
1102
|
interface IMetaRecord {
|
|
1103
1103
|
'test-vona:version': never;
|
|
1104
1104
|
}
|
|
@@ -1163,7 +1163,7 @@ declare module 'vona-module-test-vona' {
|
|
|
1163
1163
|
/** serializerTransform: begin */
|
|
1164
1164
|
export * from '../bean/serializerTransform.email.ts';
|
|
1165
1165
|
import type { ISerializerTransformOptionsEmail } from '../bean/serializerTransform.email.ts';
|
|
1166
|
-
import 'vona';
|
|
1166
|
+
import 'vona-module-a-serialization';
|
|
1167
1167
|
declare module 'vona-module-a-serialization' {
|
|
1168
1168
|
interface ISerializerTransformRecord {
|
|
1169
1169
|
'test-vona:email': ISerializerTransformOptionsEmail;
|
|
@@ -1246,7 +1246,7 @@ import type { IDtoOptionsUser } from '../dto/user.ts';
|
|
|
1246
1246
|
import type { IDtoOptionsUserCreate } from '../dto/userCreate.ts';
|
|
1247
1247
|
import type { IDtoOptionsUserLazy } from '../dto/userLazy.ts';
|
|
1248
1248
|
import type { IDtoOptionsUserUpdate } from '../dto/userUpdate.ts';
|
|
1249
|
-
import 'vona';
|
|
1249
|
+
import 'vona-module-a-web';
|
|
1250
1250
|
declare module 'vona-module-a-web' {
|
|
1251
1251
|
interface IDtoRecord {
|
|
1252
1252
|
'test-vona:categoryTree': IDtoOptionsCategoryTree;
|
|
@@ -1403,7 +1403,7 @@ import type { IControllerOptionsSummer } from '../controller/summer.ts';
|
|
|
1403
1403
|
import type { IControllerOptionsTail } from '../controller/tail.ts';
|
|
1404
1404
|
import type { IControllerOptionsTransaction } from '../controller/transaction.ts';
|
|
1405
1405
|
import type { IControllerOptionsUpload } from '../controller/upload.ts';
|
|
1406
|
-
import 'vona';
|
|
1406
|
+
import 'vona-module-a-web';
|
|
1407
1407
|
declare module 'vona-module-a-web' {
|
|
1408
1408
|
interface IControllerRecord {
|
|
1409
1409
|
'test-vona:bean': IControllerOptionsBean;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { BeanInfo, BeanAopBase, BeanAopMethodBase, BeanBase, $Class, cast, retry, BeanScopeBase } from 'vona';
|
|
2
2
|
import { Aop, AopMethod, Aspect } from 'vona-module-a-aspect';
|
|
3
3
|
import { Api, v } from 'vona-module-a-openapi';
|
|
4
|
-
import { Entity, EntityBase, Model, $relation, BeanModelBase, $relationDynamic,
|
|
4
|
+
import { Entity, EntityBase, Model, $relation, BeanModelBase, $relationDynamic, $Dto, $tableName } from 'vona-module-a-orm';
|
|
5
5
|
import { ModelCategoryChain as ModelCategoryChain$1, ModelOrder as ModelOrder$1 } from 'vona-module-test-vona';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
8
8
|
import { getKeyHash, CacheMem, BeanCacheMemBase, CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
9
9
|
import { Caching } from 'vona-module-a-caching';
|
|
10
10
|
import assert from 'node:assert';
|
|
11
|
+
import { Core } from 'vona-module-a-core';
|
|
11
12
|
import { Broadcast, BeanBroadcastBase } from 'vona-module-a-broadcast';
|
|
12
13
|
import { Event, BeanEventBase, EventListener } from 'vona-module-a-event';
|
|
13
14
|
import { Meta } from 'vona-module-a-meta';
|
|
@@ -19,10 +20,8 @@ import { Dto, Controller, Web, Arg } from 'vona-module-a-web';
|
|
|
19
20
|
import z, { z as z$1 } from 'zod';
|
|
20
21
|
import { Passport } from 'vona-module-a-user';
|
|
21
22
|
import { sleep } from '@cabloy/utils';
|
|
22
|
-
import { Captcha } from 'vona-module-a-captcha';
|
|
23
|
-
import { Core } from 'vona-module-a-core';
|
|
24
23
|
import { DtoJwtToken } from 'vona-module-a-jwt';
|
|
25
|
-
import {
|
|
24
|
+
import { SymbolUploadValue } from 'vona-module-a-upload';
|
|
26
25
|
|
|
27
26
|
var _dec$1q, _dec2$1q, _class$1q;
|
|
28
27
|
let AopRegExp = (_dec$1q = Aop({
|
|
@@ -1045,7 +1044,7 @@ let ServiceOrder = (_dec$Y = Service(), _dec2$Y = BeanInfo({
|
|
|
1045
1044
|
var _dec$X, _dec2$X, _dec3$t, _dec4$t, _dec5$q, _class$X, _class2$t;
|
|
1046
1045
|
let ServicePost = (_dec$X = Service(), _dec2$X = BeanInfo({
|
|
1047
1046
|
module: "test-vona"
|
|
1048
|
-
}), _dec3$t =
|
|
1047
|
+
}), _dec3$t = Core.transaction(), _dec4$t = Reflect.metadata("design:type", Function), _dec5$q = Reflect.metadata("design:paramtypes", []), _dec$X(_class$X = _dec2$X(_class$X = (_class2$t = class ServicePost extends BeanBase {
|
|
1049
1048
|
async findMany(params) {
|
|
1050
1049
|
return await this.scope.model.post.selectAndCount({
|
|
1051
1050
|
...params,
|
|
@@ -1438,7 +1437,7 @@ const tableNameFail$1 = '__tempTransactionFail';
|
|
|
1438
1437
|
const tableNameSuccess$1 = '__tempTransactionSuccess';
|
|
1439
1438
|
let ServiceTransaction = (_dec$R = Service(), _dec2$R = BeanInfo({
|
|
1440
1439
|
module: "test-vona"
|
|
1441
|
-
}), _dec3$s =
|
|
1440
|
+
}), _dec3$s = Core.transaction(), _dec4$s = Reflect.metadata("design:type", Function), _dec5$p = Reflect.metadata("design:paramtypes", [Object]), _dec6$p = Core.transaction(), _dec7$l = Reflect.metadata("design:type", Function), _dec8$h = Reflect.metadata("design:paramtypes", [Object]), _dec$R(_class$R = _dec2$R(_class$R = (_class2$s = class ServiceTransaction extends BeanBase {
|
|
1442
1441
|
async fail(item) {
|
|
1443
1442
|
await this.bean.model.update(`${tableNameFail$1}`, item);
|
|
1444
1443
|
await this.bean.model.update(`${tableNameFail$1}error`, item);
|
|
@@ -2459,7 +2458,7 @@ let ControllerCaptcha = (_dec$e = Controller({
|
|
|
2459
2458
|
}
|
|
2460
2459
|
}), _dec2$e = BeanInfo({
|
|
2461
2460
|
module: "test-vona"
|
|
2462
|
-
}), _dec3$d = Web.post('signin'), _dec4$d = Passport.public(), _dec5$d =
|
|
2461
|
+
}), _dec3$d = Web.post('signin'), _dec4$d = Passport.public(), _dec5$d = Core.captchaVerify({
|
|
2463
2462
|
scene: 'a-captchasimple:simple'
|
|
2464
2463
|
}), _dec6$d = function (target, key) {
|
|
2465
2464
|
return Arg.body()(target, key, 0);
|
|
@@ -2560,7 +2559,7 @@ let ControllerOnion = (_dec$b = Controller({
|
|
|
2560
2559
|
}), _dec10$6 = Aspect.aopMethod('a-orm:transaction', {
|
|
2561
2560
|
isolationLevel: 'SERIALIZABLE',
|
|
2562
2561
|
readOnly: true
|
|
2563
|
-
}), _dec11$6 =
|
|
2562
|
+
}), _dec11$6 = Core.transaction({
|
|
2564
2563
|
isolationLevel: 'READ_COMMITTED',
|
|
2565
2564
|
readOnly: false
|
|
2566
2565
|
}), _dec12$6 = Api.body(v.optional(), z$1.string()), _dec13$6 = function (target, key) {
|
|
@@ -3031,9 +3030,9 @@ let ControllerTransaction = (_dec$2 = Controller({
|
|
|
3031
3030
|
}
|
|
3032
3031
|
}), _dec2$2 = Api.exclude(), _dec3$1 = BeanInfo({
|
|
3033
3032
|
module: "test-vona"
|
|
3034
|
-
}), _dec4$1 = Web.post('fail'), _dec5$1 =
|
|
3033
|
+
}), _dec4$1 = Web.post('fail'), _dec5$1 = Core.transaction(), _dec6$1 = Passport.public(), _dec7$1 = function (target, key) {
|
|
3035
3034
|
return Arg.body()(target, key, 0);
|
|
3036
|
-
}, _dec8$1 = Reflect.metadata("design:type", Function), _dec9$1 = Reflect.metadata("design:paramtypes", [Object]), _dec0$1 = Web.post('success'), _dec1$1 =
|
|
3035
|
+
}, _dec8$1 = Reflect.metadata("design:type", Function), _dec9$1 = Reflect.metadata("design:paramtypes", [Object]), _dec0$1 = Web.post('success'), _dec1$1 = Core.transaction(), _dec10$1 = Passport.public(), _dec11$1 = function (target, key) {
|
|
3037
3036
|
return Arg.body()(target, key, 0);
|
|
3038
3037
|
}, _dec12$1 = Reflect.metadata("design:type", Function), _dec13$1 = Reflect.metadata("design:paramtypes", [Object]), _dec$2(_class$2 = _dec2$2(_class$2 = _dec3$1(_class$2 = (_class2$1 = class ControllerTransaction extends BeanBase {
|
|
3039
3038
|
async fail(item) {
|
|
@@ -3053,17 +3052,17 @@ let ControllerUpload = (_dec$1 = Controller({
|
|
|
3053
3052
|
}
|
|
3054
3053
|
}), _dec2$1 = BeanInfo({
|
|
3055
3054
|
module: "test-vona"
|
|
3056
|
-
}), _dec3 = Web.post('fields'), _dec4 = Passport.public(), _dec5 =
|
|
3055
|
+
}), _dec3 = Web.post('fields'), _dec4 = Passport.public(), _dec5 = Core.fileUpload(), _dec6 = Api.contentType('application/json'), _dec7 = function (target, key) {
|
|
3057
3056
|
return Arg.fields()(target, key, 0);
|
|
3058
3057
|
}, _dec8 = function (target, key) {
|
|
3059
3058
|
return Arg.fields('checkes', v.array(z$1.string()))(target, key, 1);
|
|
3060
3059
|
}, _dec9 = function (target, key) {
|
|
3061
3060
|
return Arg.field('name', v.default('zhennann'), v.title('your name'))(target, key, 2);
|
|
3062
|
-
}, _dec0 = Reflect.metadata("design:type", Function), _dec1 = Reflect.metadata("design:paramtypes", [Array, Array, String]), _dec10 = Web.post('file'), _dec11 = Passport.public(), _dec12 =
|
|
3061
|
+
}, _dec0 = Reflect.metadata("design:type", Function), _dec1 = Reflect.metadata("design:paramtypes", [Array, Array, String]), _dec10 = Web.post('file'), _dec11 = Passport.public(), _dec12 = Core.fileUpload(), _dec13 = Api.contentType('application/json'), _dec14 = function (target, key) {
|
|
3063
3062
|
return Arg.field('name', v.default('zhennann'))(target, key, 0);
|
|
3064
3063
|
}, _dec15 = function (target, key) {
|
|
3065
3064
|
return Arg.file('welcome')(target, key, 1);
|
|
3066
|
-
}, _dec16 = Reflect.metadata("design:type", Function), _dec17 = Reflect.metadata("design:paramtypes", [String, typeof IUploadFile === "undefined" ? Object : IUploadFile]), _dec18 = Web.post('files'), _dec19 = Passport.public(), _dec20 =
|
|
3065
|
+
}, _dec16 = Reflect.metadata("design:type", Function), _dec17 = Reflect.metadata("design:paramtypes", [String, typeof IUploadFile === "undefined" ? Object : IUploadFile]), _dec18 = Web.post('files'), _dec19 = Passport.public(), _dec20 = Core.fileUpload(), _dec21 = Api.contentType('application/json'), _dec22 = function (target, key) {
|
|
3067
3066
|
return Arg.files(v.title('more files'))(target, key, 0);
|
|
3068
3067
|
}, _dec23 = function (target, key) {
|
|
3069
3068
|
return Arg.files('images', v.title('images'))(target, key, 1);
|
package/package.json
CHANGED
package/src/.metadata/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare module 'vona-module-test-vona' {
|
|
|
42
42
|
/** aopMethod: begin */
|
|
43
43
|
export * from '../bean/aopMethod.test.ts';
|
|
44
44
|
import type { IAopMethodOptionsTest } from '../bean/aopMethod.test.ts';
|
|
45
|
-
import 'vona';
|
|
45
|
+
import 'vona-module-a-aspect';
|
|
46
46
|
declare module 'vona-module-a-aspect' {
|
|
47
47
|
|
|
48
48
|
export interface IAopMethodRecord {
|
|
@@ -83,7 +83,7 @@ import type { IEntityOptionsRole } from '../entity/role.ts';
|
|
|
83
83
|
import type { IEntityOptionsRoleUser } from '../entity/roleUser.ts';
|
|
84
84
|
import type { IEntityOptionsTest } from '../entity/test.ts';
|
|
85
85
|
import type { IEntityOptionsUser } from '../entity/user.ts';
|
|
86
|
-
import 'vona';
|
|
86
|
+
import 'vona-module-a-orm';
|
|
87
87
|
declare module 'vona-module-a-orm' {
|
|
88
88
|
|
|
89
89
|
export interface IEntityRecord {
|
|
@@ -226,7 +226,7 @@ import type { IModelOptionsTestDynamicTable } from '../model/testDynamicTable.ts
|
|
|
226
226
|
import type { IModelOptionsUser } from '../model/user.ts';
|
|
227
227
|
import type { IModelOptionsUserStats } from '../model/userStats.ts';
|
|
228
228
|
import type { IModelOptionsUserStatsGroup } from '../model/userStatsGroup.ts';
|
|
229
|
-
import 'vona';
|
|
229
|
+
import 'vona-module-a-orm';
|
|
230
230
|
declare module 'vona-module-a-orm' {
|
|
231
231
|
|
|
232
232
|
export interface IModelRecord {
|
|
@@ -915,7 +915,7 @@ export * from '../service/testData.ts';
|
|
|
915
915
|
export * from '../service/transaction.ts';
|
|
916
916
|
export * from '../service/user.ts';
|
|
917
917
|
|
|
918
|
-
import 'vona';
|
|
918
|
+
import 'vona-module-a-bean';
|
|
919
919
|
declare module 'vona-module-a-bean' {
|
|
920
920
|
|
|
921
921
|
export interface IServiceRecord {
|
|
@@ -1277,8 +1277,8 @@ declare module 'vona-module-test-vona' {
|
|
|
1277
1277
|
/** meta: begin */
|
|
1278
1278
|
export * from '../bean/meta.version.ts';
|
|
1279
1279
|
|
|
1280
|
-
import 'vona';
|
|
1281
|
-
declare module 'vona' {
|
|
1280
|
+
import 'vona-module-a-meta';
|
|
1281
|
+
declare module 'vona-module-a-meta' {
|
|
1282
1282
|
|
|
1283
1283
|
export interface IMetaRecord {
|
|
1284
1284
|
'test-vona:version': never;
|
|
@@ -1370,7 +1370,7 @@ declare module 'vona-module-test-vona' {
|
|
|
1370
1370
|
/** serializerTransform: begin */
|
|
1371
1371
|
export * from '../bean/serializerTransform.email.ts';
|
|
1372
1372
|
import type { ISerializerTransformOptionsEmail } from '../bean/serializerTransform.email.ts';
|
|
1373
|
-
import 'vona';
|
|
1373
|
+
import 'vona-module-a-serialization';
|
|
1374
1374
|
declare module 'vona-module-a-serialization' {
|
|
1375
1375
|
|
|
1376
1376
|
export interface ISerializerTransformRecord {
|
|
@@ -1468,7 +1468,7 @@ import type { IDtoOptionsUser } from '../dto/user.ts';
|
|
|
1468
1468
|
import type { IDtoOptionsUserCreate } from '../dto/userCreate.ts';
|
|
1469
1469
|
import type { IDtoOptionsUserLazy } from '../dto/userLazy.ts';
|
|
1470
1470
|
import type { IDtoOptionsUserUpdate } from '../dto/userUpdate.ts';
|
|
1471
|
-
import 'vona';
|
|
1471
|
+
import 'vona-module-a-web';
|
|
1472
1472
|
declare module 'vona-module-a-web' {
|
|
1473
1473
|
|
|
1474
1474
|
export interface IDtoRecord {
|
|
@@ -1651,7 +1651,7 @@ import type { IControllerOptionsSummer } from '../controller/summer.ts';
|
|
|
1651
1651
|
import type { IControllerOptionsTail } from '../controller/tail.ts';
|
|
1652
1652
|
import type { IControllerOptionsTransaction } from '../controller/transaction.ts';
|
|
1653
1653
|
import type { IControllerOptionsUpload } from '../controller/upload.ts';
|
|
1654
|
-
import 'vona';
|
|
1654
|
+
import 'vona-module-a-web';
|
|
1655
1655
|
declare module 'vona-module-a-web' {
|
|
1656
1656
|
|
|
1657
1657
|
export interface IControllerRecord {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
2
|
import { BeanBase } from 'vona';
|
|
3
|
-
import {
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
4
4
|
import { Passport } from 'vona-module-a-user';
|
|
5
5
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
6
6
|
import { DtoSignin } from '../dto/signin.ts';
|
|
@@ -11,7 +11,7 @@ export interface IControllerOptionsCaptcha extends IDecoratorControllerOptions {
|
|
|
11
11
|
export class ControllerCaptcha extends BeanBase {
|
|
12
12
|
@Web.post('signin')
|
|
13
13
|
@Passport.public()
|
|
14
|
-
@
|
|
14
|
+
@Core.captchaVerify({ scene: 'a-captchasimple:simple' })
|
|
15
15
|
async signin(@Arg.body() _user: DtoSignin) {
|
|
16
16
|
}
|
|
17
17
|
}
|
package/src/controller/onion.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { BeanBase } from 'vona';
|
|
|
3
3
|
import { Aspect } from 'vona-module-a-aspect';
|
|
4
4
|
import { Core } from 'vona-module-a-core';
|
|
5
5
|
import { Api, v } from 'vona-module-a-openapi';
|
|
6
|
-
import { Database } from 'vona-module-a-orm';
|
|
7
6
|
import { Passport } from 'vona-module-a-user';
|
|
8
7
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
9
8
|
import { z } from 'zod';
|
|
@@ -27,7 +26,7 @@ export class ControllerOnion extends BeanBase {
|
|
|
27
26
|
@Aspect.middlewareGlobal('a-core:gate', { gate: { mode: 'dev' } })
|
|
28
27
|
@Core.gate({ gate: { mode: 'dev' } })
|
|
29
28
|
@Aspect.aopMethod('a-orm:transaction', { isolationLevel: 'SERIALIZABLE', readOnly: true })
|
|
30
|
-
@
|
|
29
|
+
@Core.transaction({ isolationLevel: 'READ_COMMITTED', readOnly: false })
|
|
31
30
|
@Api.body(v.optional(), z.string())
|
|
32
31
|
echo(
|
|
33
32
|
@Arg.query('id', v.default(0), z.number()) id: number,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
2
2
|
import { BeanBase } from 'vona';
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
3
4
|
import { Api } from 'vona-module-a-openapi';
|
|
4
|
-
import { Database } from 'vona-module-a-orm';
|
|
5
5
|
import { Passport } from 'vona-module-a-user';
|
|
6
6
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ export interface IControllerOptionsTransaction extends IDecoratorControllerOptio
|
|
|
13
13
|
@Api.exclude()
|
|
14
14
|
export class ControllerTransaction extends BeanBase {
|
|
15
15
|
@Web.post('fail')
|
|
16
|
-
@
|
|
16
|
+
@Core.transaction()
|
|
17
17
|
@Passport.public()
|
|
18
18
|
async fail(@Arg.body() item: object) {
|
|
19
19
|
await this.bean.model.update(`${tableNameFail}` as any, item);
|
|
@@ -21,7 +21,7 @@ export class ControllerTransaction extends BeanBase {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@Web.post('success')
|
|
24
|
-
@
|
|
24
|
+
@Core.transaction()
|
|
25
25
|
@Passport.public()
|
|
26
26
|
async success(@Arg.body() item: object) {
|
|
27
27
|
await this.bean.model.update(tableNameSuccess as any, item);
|
package/src/controller/upload.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { IUploadField, IUploadFile } from 'vona-module-a-upload';
|
|
|
2
2
|
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
3
3
|
import assert from 'node:assert';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
|
+
import { Core } from 'vona-module-a-core';
|
|
5
6
|
import { Api, v } from 'vona-module-a-openapi';
|
|
6
|
-
import {
|
|
7
|
+
import { SymbolUploadValue } from 'vona-module-a-upload';
|
|
7
8
|
import { Passport } from 'vona-module-a-user';
|
|
8
9
|
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
9
10
|
import { z } from 'zod';
|
|
@@ -14,7 +15,7 @@ export interface IControllerOptionsUpload extends IDecoratorControllerOptions {}
|
|
|
14
15
|
export class ControllerUpload extends BeanBase {
|
|
15
16
|
@Web.post('fields')
|
|
16
17
|
@Passport.public()
|
|
17
|
-
@
|
|
18
|
+
@Core.fileUpload()
|
|
18
19
|
@Api.contentType('application/json')
|
|
19
20
|
fields(
|
|
20
21
|
@Arg.fields() fields: IUploadField[],
|
|
@@ -29,7 +30,7 @@ export class ControllerUpload extends BeanBase {
|
|
|
29
30
|
|
|
30
31
|
@Web.post('file')
|
|
31
32
|
@Passport.public()
|
|
32
|
-
@
|
|
33
|
+
@Core.fileUpload()
|
|
33
34
|
@Api.contentType('application/json')
|
|
34
35
|
file(@Arg.field('name', v.default('zhennann')) name: string, @Arg.file('welcome') file: IUploadFile) {
|
|
35
36
|
assert.equal(name, 'zhennann');
|
|
@@ -39,7 +40,7 @@ export class ControllerUpload extends BeanBase {
|
|
|
39
40
|
|
|
40
41
|
@Web.post('files')
|
|
41
42
|
@Passport.public()
|
|
42
|
-
@
|
|
43
|
+
@Core.fileUpload()
|
|
43
44
|
@Api.contentType('application/json')
|
|
44
45
|
files(
|
|
45
46
|
@Arg.files(v.title('more files')) files: IUploadFile[],
|
package/src/service/post.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { TableIdentity } from 'table-identity';
|
|
|
2
2
|
import type { IQueryParams } from 'vona-module-a-orm';
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
import { Service } from 'vona-module-a-bean';
|
|
5
|
-
import {
|
|
5
|
+
import { Core } from 'vona-module-a-core';
|
|
6
|
+
import { $relationDynamic } from 'vona-module-a-orm';
|
|
6
7
|
import { ModelPost } from '../model/post.ts';
|
|
7
8
|
import { ModelPostContent } from '../model/postContent.ts';
|
|
8
9
|
|
|
@@ -118,7 +119,7 @@ export class ServicePost extends BeanBase {
|
|
|
118
119
|
console.log(post?.postContent?.id);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
@
|
|
122
|
+
@Core.transaction()
|
|
122
123
|
async transaction() {
|
|
123
124
|
// insert
|
|
124
125
|
const post = await this.scope.model.post.insert({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BeanBase } from 'vona';
|
|
2
2
|
import { Service } from 'vona-module-a-bean';
|
|
3
|
-
import {
|
|
3
|
+
import { Core } from 'vona-module-a-core';
|
|
4
4
|
|
|
5
5
|
const tableNameFail = '__tempTransactionFail';
|
|
6
6
|
const tableNameSuccess = '__tempTransactionSuccess';
|
|
7
7
|
|
|
8
8
|
@Service()
|
|
9
9
|
export class ServiceTransaction extends BeanBase {
|
|
10
|
-
@
|
|
10
|
+
@Core.transaction()
|
|
11
11
|
async fail(item: object) {
|
|
12
12
|
await this.bean.model.update(`${tableNameFail}` as any, item);
|
|
13
13
|
await this.bean.model.update(`${tableNameFail}error` as any, item);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
@
|
|
16
|
+
@Core.transaction()
|
|
17
17
|
async success(item: object) {
|
|
18
18
|
await this.bean.model.update(tableNameSuccess as any, item);
|
|
19
19
|
}
|