vona-module-test-vona 5.0.44 → 5.0.46
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 +44 -1
- package/dist/bean/meta.version.d.ts +3 -2
- package/dist/controller/post.d.ts +66 -0
- package/dist/dto/postQuery.d.ts +9 -0
- package/dist/dto/postQueryRes.d.ts +12 -0
- package/dist/index.js +494 -385
- package/dist/service/post.d.ts +58 -0
- package/dist/service/user.d.ts +13 -0
- package/package.json +1 -1
- package/src/.metadata/index.ts +52 -1
- package/src/bean/meta.version.ts +17 -2
- package/src/controller/captcha.ts +1 -2
- package/src/controller/dtoTest.ts +2 -2
- package/src/controller/onion.ts +2 -2
- package/src/controller/passport.ts +2 -2
- package/src/controller/performAction.ts +2 -2
- package/src/controller/post.ts +31 -0
- package/src/controller/transaction.ts +2 -2
- package/src/controller/upload.ts +2 -2
- package/src/dto/postQuery.ts +23 -0
- package/src/dto/postQueryRes.ts +9 -0
- package/src/service/post.ts +10 -0
- package/src/service/user.ts +24 -0
- package/test/captcha.test.ts +1 -1
- package/test/database/dtoAggregate.test.ts +28 -30
- package/test/database/dtoGet.test.ts +37 -41
- package/test/database/dtoGroup.test.ts +28 -30
- package/test/database/dtoMutate.test.ts +40 -42
- package/test/database/dtoQuery.test.ts +55 -0
- package/test/database/modelRelationsJoins.test.ts +11 -0
- package/test/utils/performAction.test.ts +1 -1
|
@@ -8,37 +8,35 @@ import { ModelUserStats } from 'vona-module-test-vona';
|
|
|
8
8
|
describe('dtoAggregate.test.ts', () => {
|
|
9
9
|
it('action:dtoAggregate', async () => {
|
|
10
10
|
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// min: 'age',
|
|
19
|
-
});
|
|
20
|
-
let rules: any;
|
|
21
|
-
rules = getTargetDecoratorRules(DtoUserAggr.prototype);
|
|
22
|
-
assert.equal(rules.count_all._def.typeName, 'ZodOptional');
|
|
23
|
-
assert.equal(rules.count_all._def.innerType._def.typeName, 'ZodUnion');
|
|
24
|
-
assert.equal(rules.count_all._def.innerType._def.options[0]._def.typeName, 'ZodString');
|
|
25
|
-
assert.equal(rules.count_all._def.innerType._def.options[1]._def.typeName, 'ZodNumber');
|
|
26
|
-
assert.equal(rules.count_age._def.typeName, 'ZodOptional');
|
|
27
|
-
assert.equal(rules.sum_age._def.typeName, 'ZodOptional');
|
|
28
|
-
assert.equal(rules.avg_age._def.typeName, 'ZodOptional');
|
|
29
|
-
assert.equal(rules.max_age, undefined);
|
|
30
|
-
assert.equal(rules.min_age, undefined);
|
|
31
|
-
// aggr: usersStats: posts: autoload
|
|
32
|
-
const DtoUserStats = $Dto.get(() => ModelUserStats, {
|
|
33
|
-
columns: 'name',
|
|
34
|
-
include: { roles: true },
|
|
35
|
-
});
|
|
36
|
-
rules = getTargetDecoratorRules(DtoUserStats.prototype);
|
|
37
|
-
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
38
|
-
assert.equal(rules.iid, undefined);
|
|
39
|
-
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
40
|
-
assert.equal(rules.roles._def.typeName, 'ZodOptional');
|
|
11
|
+
// aggr
|
|
12
|
+
const DtoUserAggr = $Dto.aggregate('test-vona:user', {
|
|
13
|
+
count: ['*', 'age'],
|
|
14
|
+
sum: ['age'],
|
|
15
|
+
avg: 'age',
|
|
16
|
+
// max: 'age',
|
|
17
|
+
// min: 'age',
|
|
41
18
|
});
|
|
19
|
+
let rules: any;
|
|
20
|
+
rules = getTargetDecoratorRules(DtoUserAggr.prototype);
|
|
21
|
+
assert.equal(rules.count_all._def.typeName, 'ZodOptional');
|
|
22
|
+
assert.equal(rules.count_all._def.innerType._def.typeName, 'ZodUnion');
|
|
23
|
+
assert.equal(rules.count_all._def.innerType._def.options[0]._def.typeName, 'ZodString');
|
|
24
|
+
assert.equal(rules.count_all._def.innerType._def.options[1]._def.typeName, 'ZodNumber');
|
|
25
|
+
assert.equal(rules.count_age._def.typeName, 'ZodOptional');
|
|
26
|
+
assert.equal(rules.sum_age._def.typeName, 'ZodOptional');
|
|
27
|
+
assert.equal(rules.avg_age._def.typeName, 'ZodOptional');
|
|
28
|
+
assert.equal(rules.max_age, undefined);
|
|
29
|
+
assert.equal(rules.min_age, undefined);
|
|
30
|
+
// aggr: usersStats: posts: autoload
|
|
31
|
+
const DtoUserStats = $Dto.get(() => ModelUserStats, {
|
|
32
|
+
columns: 'name',
|
|
33
|
+
include: { roles: true },
|
|
34
|
+
});
|
|
35
|
+
rules = getTargetDecoratorRules(DtoUserStats.prototype);
|
|
36
|
+
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
37
|
+
assert.equal(rules.iid, undefined);
|
|
38
|
+
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
39
|
+
assert.equal(rules.roles._def.typeName, 'ZodOptional');
|
|
42
40
|
});
|
|
43
41
|
});
|
|
44
42
|
});
|
|
@@ -8,54 +8,50 @@ import { ModelPost, ModelPostContent, ModelRole, ModelRoleUser, ModelUser } from
|
|
|
8
8
|
describe('dtoGet.test.ts', () => {
|
|
9
9
|
it('action:dtoGet', async () => {
|
|
10
10
|
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
include: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
11
|
+
const DtoPostNew = $Dto.get(ModelPost, {
|
|
12
|
+
columns: ['id', 'title', 'userId'],
|
|
13
|
+
include: {
|
|
14
|
+
postContent: {
|
|
15
|
+
columns: ['id', 'content'],
|
|
16
|
+
include: {
|
|
17
|
+
post: { include: { user: { columns: ['id'] } } },
|
|
18
|
+
},
|
|
19
|
+
with: {
|
|
20
|
+
post3: $relationDynamic.belongsTo(() => ModelPostContent, () => ModelPost, 'postId', {
|
|
21
|
+
include: {
|
|
22
|
+
postContent: true,
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
27
25
|
},
|
|
28
26
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
const rules: any = getTargetDecoratorRules(DtoPostNew.prototype);
|
|
38
|
-
assert.equal(['ZodString', 'ZodNumber'].includes(rules.id._def.typeName), true);
|
|
39
|
-
assert.equal(rules.title._def.typeName, 'ZodString');
|
|
40
|
-
assert.equal(['ZodString', 'ZodNumber'].includes(rules.userId._def.typeName), true);
|
|
41
|
-
assert.equal(rules.iid, undefined);
|
|
42
|
-
assert.equal(rules.postContent._def.typeName, 'ZodOptional');
|
|
43
|
-
assert.equal(rules.user._def.typeName, 'ZodOptional');
|
|
44
|
-
assert.equal(rules.user3._def.typeName, 'ZodOptional');
|
|
27
|
+
},
|
|
28
|
+
with: {
|
|
29
|
+
user3: $relationDynamic.belongsTo(ModelPost, () => ModelUser, 'userId', {
|
|
30
|
+
include: { posts: true },
|
|
31
|
+
with: { roles: $relationDynamic.belongsToMany(() => ModelRoleUser, () => ModelRole, 'userId', 'roleId') },
|
|
32
|
+
columns: ['id', 'name'],
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
45
35
|
});
|
|
36
|
+
const rules: any = getTargetDecoratorRules(DtoPostNew.prototype);
|
|
37
|
+
assert.equal(['ZodString', 'ZodNumber'].includes(rules.id._def.typeName), true);
|
|
38
|
+
assert.equal(rules.title._def.typeName, 'ZodString');
|
|
39
|
+
assert.equal(['ZodString', 'ZodNumber'].includes(rules.userId._def.typeName), true);
|
|
40
|
+
assert.equal(rules.iid, undefined);
|
|
41
|
+
assert.equal(rules.postContent._def.typeName, 'ZodOptional');
|
|
42
|
+
assert.equal(rules.user._def.typeName, 'ZodOptional');
|
|
43
|
+
assert.equal(rules.user3._def.typeName, 'ZodOptional');
|
|
46
44
|
});
|
|
47
45
|
});
|
|
48
46
|
it('action:dtoGet:categoryTree', async () => {
|
|
49
47
|
await app.bean.executor.mockCtx(async () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// console.log(JSON.stringify(apiJson.components));
|
|
58
|
-
});
|
|
48
|
+
const DtoCategoryTree = $Dto.get('test-vona:category', { columns: ['id', 'name'], include: { children: { columns: ['id'] } } });
|
|
49
|
+
const rules: any = getTargetDecoratorRules(DtoCategoryTree.prototype);
|
|
50
|
+
assert.equal(rules.children._def.typeName, 'ZodEffects');
|
|
51
|
+
assert.equal(rules.iid, undefined);
|
|
52
|
+
const DtoCategoryChain = $Dto.get('test-vona:categoryChain', { columns: ['id', 'name', 'categoryIdParent'] });
|
|
53
|
+
const _apiJson = await app.bean.scope('a-openapi').service.openapi.generateJsonOfClass(DtoCategoryChain);
|
|
54
|
+
// console.log(JSON.stringify(apiJson.components));
|
|
59
55
|
});
|
|
60
56
|
});
|
|
61
57
|
});
|
|
@@ -8,37 +8,35 @@ import { ModelUserStatsGroup } from 'vona-module-test-vona';
|
|
|
8
8
|
describe('dtoGroup.test.ts', () => {
|
|
9
9
|
it('action:dtoGroup', async () => {
|
|
10
10
|
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// min: 'age',
|
|
18
|
-
});
|
|
19
|
-
let rules: any;
|
|
20
|
-
rules = getTargetDecoratorRules(DtoUserAggr.prototype);
|
|
21
|
-
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
22
|
-
assert.equal(rules.count_all._def.typeName, 'ZodOptional');
|
|
23
|
-
assert.equal(rules.count_all._def.innerType._def.typeName, 'ZodUnion');
|
|
24
|
-
assert.equal(rules.count_all._def.innerType._def.options[0]._def.typeName, 'ZodString');
|
|
25
|
-
assert.equal(rules.count_all._def.innerType._def.options[1]._def.typeName, 'ZodNumber');
|
|
26
|
-
assert.equal(rules.count_age._def.typeName, 'ZodOptional');
|
|
27
|
-
assert.equal(rules.sum_age._def.typeName, 'ZodOptional');
|
|
28
|
-
assert.equal(rules.avg_age._def.typeName, 'ZodOptional');
|
|
29
|
-
assert.equal(rules.max_age, undefined);
|
|
30
|
-
assert.equal(rules.min_age, undefined);
|
|
31
|
-
// group: userStats: posts: autoload
|
|
32
|
-
const DtoUserStats = $Dto.get(() => ModelUserStatsGroup, {
|
|
33
|
-
columns: 'name',
|
|
34
|
-
include: { roles: true },
|
|
35
|
-
});
|
|
36
|
-
rules = getTargetDecoratorRules(DtoUserStats.prototype);
|
|
37
|
-
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
38
|
-
assert.equal(rules.iid, undefined);
|
|
39
|
-
assert.equal(rules.posts._def.typeName, 'ZodEffects');
|
|
40
|
-
assert.equal(rules.roles._def.typeName, 'ZodEffects');
|
|
11
|
+
const DtoUserAggr = $Dto.group('test-vona:user', ['name'], {
|
|
12
|
+
count: ['*', 'age'],
|
|
13
|
+
sum: ['age'],
|
|
14
|
+
avg: 'age',
|
|
15
|
+
// max: 'age',
|
|
16
|
+
// min: 'age',
|
|
41
17
|
});
|
|
18
|
+
let rules: any;
|
|
19
|
+
rules = getTargetDecoratorRules(DtoUserAggr.prototype);
|
|
20
|
+
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
21
|
+
assert.equal(rules.count_all._def.typeName, 'ZodOptional');
|
|
22
|
+
assert.equal(rules.count_all._def.innerType._def.typeName, 'ZodUnion');
|
|
23
|
+
assert.equal(rules.count_all._def.innerType._def.options[0]._def.typeName, 'ZodString');
|
|
24
|
+
assert.equal(rules.count_all._def.innerType._def.options[1]._def.typeName, 'ZodNumber');
|
|
25
|
+
assert.equal(rules.count_age._def.typeName, 'ZodOptional');
|
|
26
|
+
assert.equal(rules.sum_age._def.typeName, 'ZodOptional');
|
|
27
|
+
assert.equal(rules.avg_age._def.typeName, 'ZodOptional');
|
|
28
|
+
assert.equal(rules.max_age, undefined);
|
|
29
|
+
assert.equal(rules.min_age, undefined);
|
|
30
|
+
// group: userStats: posts: autoload
|
|
31
|
+
const DtoUserStats = $Dto.get(() => ModelUserStatsGroup, {
|
|
32
|
+
columns: 'name',
|
|
33
|
+
include: { roles: true },
|
|
34
|
+
});
|
|
35
|
+
rules = getTargetDecoratorRules(DtoUserStats.prototype);
|
|
36
|
+
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
37
|
+
assert.equal(rules.iid, undefined);
|
|
38
|
+
assert.equal(rules.posts._def.typeName, 'ZodEffects');
|
|
39
|
+
assert.equal(rules.roles._def.typeName, 'ZodEffects');
|
|
42
40
|
});
|
|
43
41
|
});
|
|
44
42
|
});
|
|
@@ -8,49 +8,47 @@ import { ModelPost } from 'vona-module-test-vona';
|
|
|
8
8
|
describe('dtoMutate.test.ts', () => {
|
|
9
9
|
it('action:dtoMutate', async () => {
|
|
10
10
|
await app.bean.executor.mockCtx(async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
include: { posts: true },
|
|
15
|
-
});
|
|
16
|
-
let rules: any;
|
|
17
|
-
rules = getTargetDecoratorRules(DtoUserCreate.prototype);
|
|
18
|
-
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
19
|
-
assert.equal(rules.id, undefined);
|
|
20
|
-
assert.equal(rules.iid, undefined);
|
|
21
|
-
assert.equal(rules.deleted, undefined);
|
|
22
|
-
assert.equal(rules.createdAt, undefined);
|
|
23
|
-
assert.equal(rules.updatedAt, undefined);
|
|
24
|
-
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
25
|
-
// update
|
|
26
|
-
const DtoUserUpdate = $Dto.update('test-vona:user', {
|
|
27
|
-
with: {
|
|
28
|
-
posts: $relationDynamic.hasMany(() => ModelPost, 'userId', { columns: ['id', 'title'] }),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
rules = getTargetDecoratorRules(DtoUserUpdate.prototype);
|
|
32
|
-
assert.equal(rules.name._def.typeName, 'ZodString'); // ZodOptional
|
|
33
|
-
assert.equal(rules.id, undefined);
|
|
34
|
-
assert.equal(rules.iid, undefined);
|
|
35
|
-
assert.equal(rules.deleted, undefined);
|
|
36
|
-
assert.equal(rules.createdAt, undefined);
|
|
37
|
-
assert.equal(rules.updatedAt, undefined);
|
|
38
|
-
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
39
|
-
// create: not mutate post(belongsTo)
|
|
40
|
-
const DtoPostCreate = $Dto.create('test-vona:post', {
|
|
41
|
-
include: {
|
|
42
|
-
postContent: true,
|
|
43
|
-
user: true,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
rules = getTargetDecoratorRules(DtoPostCreate.prototype);
|
|
47
|
-
assert.equal(rules.title._def.typeName, 'ZodString'); // ZodOptional
|
|
48
|
-
assert.equal(rules.stars._def.typeName, 'ZodOptional');
|
|
49
|
-
assert.equal(['ZodString', 'ZodNumber'].includes(rules.userId._def.typeName), true);
|
|
50
|
-
assert.equal(rules.postContent._def.typeName, 'ZodOptional');
|
|
51
|
-
assert.equal(rules.user, undefined);
|
|
52
|
-
assert.equal(rules.id, undefined);
|
|
11
|
+
// create
|
|
12
|
+
const DtoUserCreate = $Dto.create('test-vona:user', {
|
|
13
|
+
include: { posts: true },
|
|
53
14
|
});
|
|
15
|
+
let rules: any;
|
|
16
|
+
rules = getTargetDecoratorRules(DtoUserCreate.prototype);
|
|
17
|
+
assert.equal(rules.name._def.typeName, 'ZodString');
|
|
18
|
+
assert.equal(rules.id, undefined);
|
|
19
|
+
assert.equal(rules.iid, undefined);
|
|
20
|
+
assert.equal(rules.deleted, undefined);
|
|
21
|
+
assert.equal(rules.createdAt, undefined);
|
|
22
|
+
assert.equal(rules.updatedAt, undefined);
|
|
23
|
+
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
24
|
+
// update
|
|
25
|
+
const DtoUserUpdate = $Dto.update('test-vona:user', {
|
|
26
|
+
with: {
|
|
27
|
+
posts: $relationDynamic.hasMany(() => ModelPost, 'userId', { columns: ['id', 'title'] }),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
rules = getTargetDecoratorRules(DtoUserUpdate.prototype);
|
|
31
|
+
assert.equal(rules.name._def.typeName, 'ZodString'); // ZodOptional
|
|
32
|
+
assert.equal(rules.id, undefined);
|
|
33
|
+
assert.equal(rules.iid, undefined);
|
|
34
|
+
assert.equal(rules.deleted, undefined);
|
|
35
|
+
assert.equal(rules.createdAt, undefined);
|
|
36
|
+
assert.equal(rules.updatedAt, undefined);
|
|
37
|
+
assert.equal(rules.posts._def.typeName, 'ZodOptional');
|
|
38
|
+
// create: not mutate post(belongsTo)
|
|
39
|
+
const DtoPostCreate = $Dto.create('test-vona:post', {
|
|
40
|
+
include: {
|
|
41
|
+
postContent: true,
|
|
42
|
+
user: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
rules = getTargetDecoratorRules(DtoPostCreate.prototype);
|
|
46
|
+
assert.equal(rules.title._def.typeName, 'ZodString'); // ZodOptional
|
|
47
|
+
assert.equal(rules.stars._def.typeName, 'ZodOptional');
|
|
48
|
+
assert.equal(['ZodString', 'ZodNumber'].includes(rules.userId._def.typeName), true);
|
|
49
|
+
assert.equal(rules.postContent._def.typeName, 'ZodOptional');
|
|
50
|
+
assert.equal(rules.user, undefined);
|
|
51
|
+
assert.equal(rules.id, undefined);
|
|
54
52
|
});
|
|
55
53
|
});
|
|
56
54
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IQueryParams } from 'vona-module-a-orm';
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
import { describe, it } from 'node:test';
|
|
4
|
+
import { isNil } from '@cabloy/utils';
|
|
5
|
+
import { app } from 'vona-mock';
|
|
6
|
+
|
|
7
|
+
describe('dtoQuery.test.ts', () => {
|
|
8
|
+
it('action:dtoQuery', async () => {
|
|
9
|
+
await app.bean.executor.mockCtx(async () => {
|
|
10
|
+
// findManyEcho
|
|
11
|
+
const resEcho: IQueryParams = await app.bean.executor.performAction('get', '/test/vona/post/findManyEcho', {
|
|
12
|
+
query: {
|
|
13
|
+
columns: 'id,title', // ['id', 'title'],
|
|
14
|
+
where: {
|
|
15
|
+
stars: {
|
|
16
|
+
_gt_: 12,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
orders: [['testVonaPost.createdAt', 'desc']],
|
|
20
|
+
pageNo: 2,
|
|
21
|
+
pageSize: 30,
|
|
22
|
+
title: 'ai',
|
|
23
|
+
userName: 'tom',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
assert.deepEqual(resEcho.columns, ['id', 'title']);
|
|
27
|
+
assert.deepEqual(resEcho.where, {
|
|
28
|
+
'stars': { _gt_: 12 },
|
|
29
|
+
'title': { _includesI_: 'ai' },
|
|
30
|
+
'testVonaUser.name': 'tom',
|
|
31
|
+
});
|
|
32
|
+
assert.deepEqual(resEcho.orders, [['testVonaPost.createdAt', 'desc']]);
|
|
33
|
+
assert.equal(resEcho.offset, 30);
|
|
34
|
+
assert.equal(resEcho.limit, 30);
|
|
35
|
+
// findMany
|
|
36
|
+
const res = await app.bean.executor.performAction('get', '/test/vona/post/findMany', {
|
|
37
|
+
query: {
|
|
38
|
+
columns: 'id,title', // ['id', 'title'],
|
|
39
|
+
where: {
|
|
40
|
+
stars: {
|
|
41
|
+
_gt_: 12,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
orders: [['testVonaPost.createdAt', 'desc']],
|
|
45
|
+
pageNo: 2,
|
|
46
|
+
pageSize: 30,
|
|
47
|
+
title: 'ai',
|
|
48
|
+
userName: 'tom',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
assert.equal(Array.isArray(res.list), true);
|
|
52
|
+
assert.equal(!isNil(res.total), true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -32,6 +32,17 @@ describe('modelRelationsJoins.test.ts', () => {
|
|
|
32
32
|
orders: [['testVonaUser.id', 'asc']],
|
|
33
33
|
}, {}, ['test-vona:user']);
|
|
34
34
|
assert.equal(itemsJoins2.length, 0);
|
|
35
|
+
// joins: manual: no table prefix
|
|
36
|
+
const itemsJoins3 = await scopeTest.model.post.select({
|
|
37
|
+
columns: ['id', 'title'],
|
|
38
|
+
joins: [['innerJoin', 'testVonaUser', ['userId', 'testVonaUser.id']]],
|
|
39
|
+
where: {
|
|
40
|
+
'testVonaUser.id': userJimmy.id,
|
|
41
|
+
'userId': userJimmy.id,
|
|
42
|
+
},
|
|
43
|
+
orders: [['testVonaUser.id', 'asc'], ['testVonaPost.createdAt', 'asc']],
|
|
44
|
+
}, {}, ['test-vona:user']);
|
|
45
|
+
assert.equal(itemsJoins3.length, 0);
|
|
35
46
|
// test data: delete
|
|
36
47
|
await scopeTest.service.testData.drop(testData);
|
|
37
48
|
});
|
|
@@ -18,7 +18,7 @@ describe('performAction.test.ts', () => {
|
|
|
18
18
|
const result: { id: number; url: string } = await app.bean.executor.mockCtx(async () => {
|
|
19
19
|
return await app.bean.executor.performAction('post', '/test/vona/performAction/echo', {
|
|
20
20
|
onions: {
|
|
21
|
-
pipe: { 'a-
|
|
21
|
+
pipe: { 'a-web:valid': { enable: false } },
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
});
|