vona-module-test-vona 5.0.44 → 5.0.45
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/index.js +26 -0
- package/dist/service/user.d.ts +13 -0
- package/package.json +1 -1
- package/src/service/user.ts +24 -0
- package/test/captcha.test.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1428,6 +1428,32 @@ var _dec$C, _dec2$C, _class$C;
|
|
|
1428
1428
|
let ServiceUser = (_dec$C = Service(), _dec2$C = BeanInfo({
|
|
1429
1429
|
module: "test-vona"
|
|
1430
1430
|
}), _dec$C(_class$C = _dec2$C(_class$C = class ServiceUser extends BeanBase {
|
|
1431
|
+
async userStats() {
|
|
1432
|
+
const userStats = await this.scope.model.user.aggregate({
|
|
1433
|
+
aggrs: {
|
|
1434
|
+
count: '*',
|
|
1435
|
+
sum: 'scores',
|
|
1436
|
+
max: 'age',
|
|
1437
|
+
min: 'age'
|
|
1438
|
+
},
|
|
1439
|
+
where: {
|
|
1440
|
+
scores: {
|
|
1441
|
+
_gt_: 30
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
return userStats;
|
|
1446
|
+
}
|
|
1447
|
+
async findUsers() {
|
|
1448
|
+
const users = await this.scope.model.user.select({
|
|
1449
|
+
where: {
|
|
1450
|
+
age: {
|
|
1451
|
+
_gt_: 18
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
return users;
|
|
1456
|
+
}
|
|
1431
1457
|
async relationBelongsToMany() {
|
|
1432
1458
|
// insert: roles
|
|
1433
1459
|
const roles = await this.scope.model.role.insertBulk([{
|
package/dist/service/user.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { BeanBase } from 'vona';
|
|
2
2
|
export declare class ServiceUser extends BeanBase {
|
|
3
|
+
userStats(): Promise<import("vona-module-a-orm").TypeRecordAggrsValuesToObject<import("vona-module-a-orm").TypeRecordAggrsValues<{
|
|
4
|
+
count: "count_all";
|
|
5
|
+
sum: "sum_scores";
|
|
6
|
+
max: "max_age";
|
|
7
|
+
min: "min_age";
|
|
8
|
+
}>>>;
|
|
9
|
+
findUsers(): Promise<import("vona-module-a-orm").TypeModelRelationResult_Normal<import("vona-module-test-vona").EntityUser, import("vona-module-test-vona").ModelUser, {
|
|
10
|
+
where: {
|
|
11
|
+
age: {
|
|
12
|
+
_gt_: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}, undefined, 50>[]>;
|
|
3
16
|
relationBelongsToMany(): Promise<void>;
|
|
4
17
|
}
|
package/package.json
CHANGED
package/src/service/user.ts
CHANGED
|
@@ -6,6 +6,30 @@ import { ModelRoleUser } from '../model/roleUser.ts';
|
|
|
6
6
|
|
|
7
7
|
@Service()
|
|
8
8
|
export class ServiceUser extends BeanBase {
|
|
9
|
+
async userStats() {
|
|
10
|
+
const userStats = await this.scope.model.user.aggregate({
|
|
11
|
+
aggrs: {
|
|
12
|
+
count: '*',
|
|
13
|
+
sum: 'scores',
|
|
14
|
+
max: 'age',
|
|
15
|
+
min: 'age',
|
|
16
|
+
},
|
|
17
|
+
where: {
|
|
18
|
+
scores: { _gt_: 30 },
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return userStats;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async findUsers() {
|
|
25
|
+
const users = await this.scope.model.user.select({
|
|
26
|
+
where: {
|
|
27
|
+
age: { _gt_: 18 },
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return users;
|
|
31
|
+
}
|
|
32
|
+
|
|
9
33
|
async relationBelongsToMany() {
|
|
10
34
|
// insert: roles
|
|
11
35
|
const roles = await this.scope.model.role.insertBulk([
|
package/test/captcha.test.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { app } from 'vona-mock';
|
|
|
7
7
|
describe('captcha.test.ts', () => {
|
|
8
8
|
// scene/provider
|
|
9
9
|
const sceneName = 'a-captchasimple:simple';
|
|
10
|
-
const providerName = 'a-captchasimple:
|
|
10
|
+
const providerName = 'a-captchasimple:imageText';
|
|
11
11
|
it('action:captcha', async () => {
|
|
12
12
|
await app.bean.executor.mockCtx(async () => {
|
|
13
13
|
// create
|