vona-cli-set-api 1.0.273 → 1.0.274

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.
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.157"
49
+ "vona": "^5.0.158"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-home-user",
3
3
  "type": "module",
4
- "version": "5.0.8",
4
+ "version": "5.0.9",
5
5
  "title": "home-user",
6
6
  "vonaModule": {
7
7
  "fileVersion": 1,
@@ -144,7 +144,7 @@ import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'von
144
144
  declare module 'vona-module-home-user' {
145
145
  export interface IModelOptionsUser {
146
146
  relations: {
147
- roles: IModelRelationBelongsToMany<ModelRoleUser, ModelRole, false, 'id'|'name',undefined,undefined,undefined>;
147
+ roles: IModelRelationBelongsToMany<ModelRoleUser, ModelRole, false, undefined,undefined,undefined,undefined>;
148
148
  };
149
149
  }
150
150
  export interface ModelRole {
@@ -22,7 +22,7 @@ export class EntityUser extends EntityBase {
22
22
  mobile?: string;
23
23
 
24
24
  @Api.field(v.title($locale('UserActivated')), v.default(false))
25
- activated: boolean;
25
+ activated?: boolean;
26
26
 
27
27
  @Api.field(v.title($locale('UserLocale')), z.string().optional())
28
28
  locale?: keyof ILocaleInfos | undefined;
@@ -9,7 +9,7 @@ export interface IModelOptionsUser extends IDecoratorModelOptions<EntityUser> {}
9
9
  @Model<IModelOptionsUser>({
10
10
  entity: EntityUser,
11
11
  relations: {
12
- roles: $relation.belongsToMany(() => ModelRoleUser, () => ModelRole, 'userId', 'roleId', { columns: ['id', 'name'] }),
12
+ roles: $relation.belongsToMany(() => ModelRoleUser, () => ModelRole, 'userId', 'roleId'),
13
13
  },
14
14
  })
15
15
  export class ModelUser extends BeanModelBase<EntityUser> {
@@ -1,19 +1,20 @@
1
1
  import type { TableIdentity } from 'table-identity';
2
- import type { IRoleAdapter, IRoleBase } from 'vona-module-a-user';
2
+ import type { IRoleAdapter } from 'vona-module-a-user';
3
+ import type { EntityRole } from 'vona-module-test-vona';
3
4
  import { BeanBase } from 'vona';
4
5
  import { Service } from 'vona-module-a-bean';
5
6
 
6
7
  @Service()
7
8
  export class ServiceRoleAdapter extends BeanBase implements IRoleAdapter {
8
- async findOneByName(name: string): Promise<IRoleBase | undefined> {
9
+ async findOneByName(name: string): Promise<EntityRole | undefined> {
9
10
  return await this.scope.model.role.getByNameEqI(name);
10
11
  }
11
12
 
12
- async findOne(role: Partial<IRoleBase>): Promise<IRoleBase | undefined> {
13
+ async findOne(role: Partial<EntityRole>): Promise<EntityRole | undefined> {
13
14
  return await this.scope.model.role.get(role);
14
15
  }
15
16
 
16
- async findAllByUserId(userId: TableIdentity): Promise<IRoleBase[] | undefined> {
17
+ async findAllByUserId(userId: TableIdentity): Promise<EntityRole[] | undefined> {
17
18
  const user = await this.scope.model.user.get({ id: userId }, { include: { roles: true } });
18
19
  return user?.roles;
19
20
  }
@@ -1,40 +1,41 @@
1
1
  import type { TableIdentity } from 'table-identity';
2
2
  import type { IAuthUserProfile, IUserAdapter, IUserBase } from 'vona-module-a-user';
3
+ import type { EntityUser } from '../entity/user.ts';
3
4
  import { BeanBase } from 'vona';
4
5
  import { Service } from 'vona-module-a-bean';
5
6
 
6
7
  @Service()
7
8
  export class ServiceUserAdapter extends BeanBase implements IUserAdapter {
8
- async create(user: Partial<IUserBase>): Promise<IUserBase> {
9
+ async create(user: Partial<EntityUser>): Promise<EntityUser> {
9
10
  return await this.scope.model.user.insert(user);
10
11
  }
11
12
 
12
- async userOfProfile(profile: IAuthUserProfile): Promise<IUserBase> {
13
+ async userOfProfile(profile: IAuthUserProfile): Promise<Partial<EntityUser>> {
13
14
  return {
14
15
  name: profile.username!,
15
16
  email: profile.emails?.[0].value,
16
17
  avatar: profile.photos?.[0].value,
17
18
  locale: profile.locale || this.ctx.locale,
18
- } as IUserBase;
19
+ };
19
20
  }
20
21
 
21
- async createAnonymous(): Promise<IUserBase> {
22
- return { id: -1, anonymous: true, name: 'anonymous', avatar: undefined, locale: undefined } as IUserBase;
22
+ async createAnonymous(): Promise<Partial<IUserBase>> {
23
+ return { id: -1, anonymous: true, name: 'anonymous' };
23
24
  }
24
25
 
25
- async findOneByName(name: string): Promise<IUserBase | undefined> {
26
+ async findOneByName(name: string): Promise<EntityUser | undefined> {
26
27
  return await this.scope.model.user.getByNameEqI(name);
27
28
  }
28
29
 
29
- async findOne(user: Partial<IUserBase>): Promise<IUserBase | undefined> {
30
+ async findOne(user: Partial<EntityUser>): Promise<EntityUser | undefined> {
30
31
  return await this.scope.model.user.get(user);
31
32
  }
32
33
 
33
- async update(user: Partial<IUserBase>): Promise<void> {
34
+ async update(user: Partial<EntityUser>): Promise<void> {
34
35
  await this.scope.model.user.update(user);
35
36
  }
36
37
 
37
- async remove(user: Partial<IUserBase>): Promise<void> {
38
+ async remove(user: Partial<EntityUser>): Promise<void> {
38
39
  await this.scope.model.user.delete(user);
39
40
  }
40
41
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-suite-a-home",
3
3
  "type": "module",
4
- "version": "5.0.9",
4
+ "version": "5.0.10",
5
5
  "title": "a-home",
6
6
  "description": "",
7
7
  "author": "zhennann",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.273",
4
+ "version": "1.0.274",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"