@drax/identity-front 0.0.22 → 0.0.25

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.0.22",
6
+ "version": "0.0.25",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -24,7 +24,9 @@
24
24
  "format": "prettier --write src/"
25
25
  },
26
26
  "dependencies": {
27
- "@drax/common-front": "^0.0.22"
27
+ "@drax/common-front": "^0.0.25",
28
+ "@drax/common-share": "^0.0.25",
29
+ "@drax/identity-share": "^0.0.25"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@rushstack/eslint-patch": "^1.8.0",
@@ -46,5 +48,5 @@
46
48
  "vite-plugin-dts": "^3.9.1",
47
49
  "vitest": "^1.4.0"
48
50
  },
49
- "gitHead": "2ff21dad6e1e9cc9119bf3c3095c3b291d850e53"
51
+ "gitHead": "606497ae64684b17c757a72ed57a4a7dda0f1f8e"
50
52
  }
package/src/index.ts CHANGED
@@ -28,9 +28,7 @@ import type {IUserProvider} from "./interfaces/IUserProvider"
28
28
  import type {IRoleProvider} from "./interfaces/IRoleProvider"
29
29
  import type {ITenantProvider} from "./interfaces/ITenantProvider"
30
30
  import type {IAuthUser} from "./interfaces/IAuthUser"
31
- import type {IUser, IUserCreate, IUserUpdate, IUserPassword} from "./interfaces/IUser"
32
- import type {IRole, IRoleBase} from "./interfaces/IRole"
33
- import type {ITenant, ITenantBase} from "./interfaces/ITenant"
31
+ import type {IUserPassword} from "./interfaces/IUserPassword"
34
32
  import type {ILoginResponse} from "./interfaces/ILoginResponse"
35
33
 
36
34
  export type {
@@ -39,9 +37,6 @@ export type {
39
37
  IRoleProvider,
40
38
  ITenantProvider,
41
39
  IAuthUser,
42
- IUser, IUserCreate, IUserUpdate,
43
- IRole, IRoleBase,
44
- ITenant, ITenantBase,
45
40
  IUserPassword,
46
41
  ILoginResponse
47
42
  }
@@ -1,4 +1,4 @@
1
- import type {IRole} from "./IRole";
1
+ import type {IRole} from "@drax/identity-share";
2
2
 
3
3
  interface IAuthUser {
4
4
  id: string
@@ -1,13 +1,9 @@
1
- import type {IRole, IRoleBase} from "./IRole";
2
- import type {IPaginateClient} from "@drax/common-front";
1
+ import type {IRole, IRoleBase} from "@drax/identity-share";
2
+ import type {IDraxCrud} from "@drax/common-share";
3
3
 
4
- interface IRoleProvider {
4
+ interface IRoleProvider extends IDraxCrud<IRole, IRoleBase, IRoleBase>{
5
5
  fetchRole(): Promise<IRole[]>
6
6
  fetchPermissions(): Promise<any>
7
- paginateRole(page: number, limit: number, search:string): Promise<IPaginateClient<IRole>>
8
- createRole(input: IRoleBase): Promise<IRole>
9
- editRole(id: string, input: IRoleBase): Promise<IRole>
10
- deleteRole(id: string): Promise<any>
11
7
  }
12
8
 
13
9
  export type {IRoleProvider}
@@ -1,12 +1,8 @@
1
- import type {ITenant, ITenantBase} from "./ITenant";
2
- import type {IPaginateClient} from "@drax/common-front";
1
+ import type {ITenant, ITenantBase} from "@drax/identity-share";
2
+ import type {IDraxCrud} from "@drax/common-share";
3
3
 
4
- interface ITenantProvider {
4
+ interface ITenantProvider extends IDraxCrud<ITenant, ITenantBase, ITenantBase> {
5
5
  fetchTenant(): Promise<ITenant[]>
6
- paginateTenant(page: number, limit: number, search:string): Promise<IPaginateClient<ITenant>>
7
- createTenant(input: ITenantBase): Promise<ITenant>
8
- editTenant(id: string, input: ITenantBase): Promise<ITenant>
9
- deleteTenant(id: string): Promise<any>
10
6
  }
11
7
 
12
8
  export type {ITenantProvider}
@@ -0,0 +1,6 @@
1
+ interface IUserPassword{
2
+ newPassword: string
3
+ confirmPassword: string
4
+ }
5
+
6
+ export type {IUserPassword}
@@ -1,13 +1,8 @@
1
- import type {IUser, IUserCreate, IUserUpdate} from "./IUser";
2
- import type {IPaginateClient} from "@drax/common-front";
1
+ import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
2
+ import type {IDraxCrud} from "@drax/common-share";
3
3
 
4
4
 
5
-
6
- interface IUserProvider {
7
- paginateUser(page: number, limit: number, search?:string): Promise<IPaginateClient<IUser>>
8
- createUser(input: IUserCreate): Promise<IUser>
9
- editUser(id: string, input: IUserUpdate): Promise<IUser>
10
- deleteUser(id: string): Promise<any>
5
+ interface IUserProvider extends IDraxCrud<IUser, IUserCreate, IUserUpdate>{
11
6
  changeUserPassword(id: string, newPassword: string): Promise<boolean>
12
7
  }
13
8
 
@@ -1,6 +1,7 @@
1
- import type {IGqlClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IGqlClient} from '@drax/common-front'
2
2
  import type {IRoleProvider} from "../../interfaces/IRoleProvider";
3
- import type {IRole, IRoleBase} from "../../interfaces/IRole";
3
+ import type {IRole, IRoleBase} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
5
 
5
6
 
6
7
  class RoleGqlProvider implements IRoleProvider {
@@ -33,7 +34,7 @@ class RoleGqlProvider implements IRoleProvider {
33
34
  return data.fetchRole
34
35
  }
35
36
 
36
- async createRole(payload: IRoleBase): Promise<IRole> {
37
+ async create(payload: IRoleBase): Promise<IRole> {
37
38
  const query: string = `mutation createRole($input: RoleInput) {
38
39
  createRole(input: $input) {id name permissions childRoles{id name} readonly }
39
40
  }`
@@ -42,7 +43,7 @@ class RoleGqlProvider implements IRoleProvider {
42
43
  return data.createRole
43
44
  }
44
45
 
45
- async editRole(id: string, payload: IRoleBase): Promise<IRole> {
46
+ async update(id: string, payload: IRoleBase): Promise<IRole> {
46
47
  const query: string = `mutation updateRole($id: ID!, $input: RoleInput) { updateRole(id: $id, input: $input) {
47
48
  id name permissions childRoles{id name} readonly } }`
48
49
  const variables = {id, input: payload}
@@ -50,20 +51,20 @@ class RoleGqlProvider implements IRoleProvider {
50
51
  return data.createRole
51
52
  }
52
53
 
53
- async deleteRole(id: string): Promise<any> {
54
+ async delete(id: string): Promise<any> {
54
55
  const query: string = `mutation deleteRole($id: ID!) { deleteRole(id: $id) }`
55
56
  const variables = {id: id}
56
57
  let data = await this.gqlClient.mutation(query, variables)
57
58
  return data.createRole
58
59
  }
59
60
 
60
- async paginateRole(page: number, limit: number, search:string = ""): Promise<IPaginateClient<IRole>> {
61
- const query: string = `query paginateRole($page: Int, $limit: Int, $search:String) {
61
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<IRole>> {
62
+ const query: string = `query paginateRole($options: PaginateOptions) {
62
63
  paginateRole(page: $page, limit: $limit, search: $search) {
63
64
  total, page, limit, items{id name permissions childRoles{id name} readonly }
64
65
  }
65
66
  }`
66
- const variables = {page, limit,search}
67
+ const variables = {options: {page, limit, orderBy, orderDesc, search}}
67
68
  let data = await this.gqlClient.query(query, variables)
68
69
  return data.paginateRole
69
70
  }
@@ -1,6 +1,7 @@
1
- import type {IGqlClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IGqlClient} from '@drax/common-front'
2
2
  import type {ITenantProvider} from "../../interfaces/ITenantProvider";
3
- import type {ITenant} from "../../interfaces/ITenant";
3
+ import type {ITenant, ITenantBase} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
5
 
5
6
 
6
7
  class TenantGqlProvider implements ITenantProvider {
@@ -27,7 +28,7 @@ class TenantGqlProvider implements ITenantProvider {
27
28
  return data.fetchTenant
28
29
  }
29
30
 
30
- async createTenant(payload: ITenant): Promise<any> {
31
+ async create(payload: ITenantBase): Promise<any> {
31
32
  const query: string = `mutation createTenant($input: TenantInput) {
32
33
  createTenant(input: $input) {id name }
33
34
  }`
@@ -36,7 +37,7 @@ class TenantGqlProvider implements ITenantProvider {
36
37
  return data.createTenant
37
38
  }
38
39
 
39
- async editTenant(id: string, payload: ITenant): Promise<ITenant> {
40
+ async update(id: string, payload: ITenantBase): Promise<ITenant> {
40
41
  const query: string = `mutation updateTenant($id: ID!, $input: TenantInput) { updateTenant(id: $id, input: $input) {
41
42
  id name } }`
42
43
  const variables = {id, input: payload}
@@ -44,20 +45,20 @@ class TenantGqlProvider implements ITenantProvider {
44
45
  return data.createTenant
45
46
  }
46
47
 
47
- async deleteTenant(id: string): Promise<any> {
48
+ async delete(id: string): Promise<any> {
48
49
  const query: string = `mutation deleteTenant($id: ID!) { deleteTenant(id: $id) }`
49
50
  const variables = {id: id}
50
51
  let data = await this.gqlClient.mutation(query, variables)
51
52
  return data.createTenant
52
53
  }
53
54
 
54
- async paginateTenant(page: number, limit: number, search:string = ""): Promise<IPaginateClient<ITenant>> {
55
- const query: string = `query paginateTenant($page: Int, $limit: Int, $search:String) {
55
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<ITenant>> {
56
+ const query: string = `query paginateTenant($options: PaginateOptions) {
56
57
  paginateTenant(page: $page, limit: $limit, search: $search) {
57
58
  total, page, limit, items{id, name }
58
59
  }
59
60
  }`
60
- const variables = {page, limit,search}
61
+ const variables = {options: {page, limit, orderBy, orderDesc, search}}
61
62
  let data = await this.gqlClient.query(query, variables)
62
63
  return data.paginateTenant
63
64
  }
@@ -1,6 +1,7 @@
1
- import type {IGqlClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IGqlClient} from '@drax/common-front'
2
2
  import type {IUserProvider} from "../../interfaces/IUserProvider";
3
- import type {IUser, IUserCreate, IUserUpdate} from "../../interfaces/IUser";
3
+ import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
5
 
5
6
  class UserGqlProvider implements IUserProvider {
6
7
 
@@ -18,7 +19,7 @@ class UserGqlProvider implements IUserProvider {
18
19
  this.gqlClient.removeHeader('Authorization')
19
20
  }
20
21
 
21
- async createUser(payload: IUserCreate): Promise<IUser> {
22
+ async create(payload: IUserCreate): Promise<IUser> {
22
23
  const query: string = `mutation createUser($input: UserCreateInput) { createUser(input: $input) {
23
24
  id username name email phone active role{id name} tenant{id name} } }`
24
25
  const variables = {input: payload}
@@ -26,7 +27,7 @@ class UserGqlProvider implements IUserProvider {
26
27
  return data.createUser
27
28
  }
28
29
 
29
- async editUser(id: string, payload: IUserUpdate): Promise<IUser> {
30
+ async update(id: string, payload: IUserUpdate): Promise<IUser> {
30
31
  const query: string = `mutation updateUser($id: ID!, $input: UserUpdateInput) { updateUser(id: $id, input: $input) {
31
32
  id username name email phone active role{id name} tenant{id name} } }`
32
33
  const variables = {id, input: payload}
@@ -41,20 +42,20 @@ class UserGqlProvider implements IUserProvider {
41
42
  return data.changeUserPassword
42
43
  }
43
44
 
44
- async deleteUser(id: string): Promise<any> {
45
+ async delete(id: string): Promise<any> {
45
46
  const query: string = `mutation deleteUser($id: ID!) { deleteUser(id: $id) }`
46
47
  const variables = {id: id}
47
48
  let data = await this.gqlClient.mutation(query, variables)
48
49
  return data.createUser
49
50
  }
50
51
 
51
- async paginateUser(page: number, limit: number, search:string = ""): Promise<IPaginateClient<IUser>> {
52
- const query: string = `query paginateUser($page: Int, $limit: Int, $search:String) {
52
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<IUser>> {
53
+ const query: string = `query paginateUser($options: PaginateOptions) {
53
54
  paginateUser(page: $page, limit: $limit, search: $search) {
54
55
  total, page, limit, items{ id, name username, email, phone, active, role{id, name} tenant{id name} }
55
56
  }
56
57
  }`
57
- const variables = {page, limit, search}
58
+ const variables = {options: {page, limit, orderBy, orderDesc, search}}
58
59
  let data = await this.gqlClient.query(query, variables)
59
60
  return data.paginateUser
60
61
  }
@@ -1,6 +1,7 @@
1
- import type {IHttpClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IHttpClient} from '@drax/common-front'
2
2
  import type {IRoleProvider} from "../../interfaces/IRoleProvider.ts";
3
- import type {IRole, IRoleBase} from "../../interfaces/IRole";
3
+ import type {IRole, IRoleBase} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
5
 
5
6
  class RoleRestProvider implements IRoleProvider {
6
7
 
@@ -10,13 +11,6 @@ class RoleRestProvider implements IRoleProvider {
10
11
  this.httpClient = httpClient
11
12
  }
12
13
 
13
- setHttpClientToken(token: string): void {
14
- this.httpClient.addHeader('Authorization', `Bearer ${token}`)
15
- }
16
-
17
- removeHttpClientToken(): void {
18
- this.httpClient.removeHeader('Authorization')
19
- }
20
14
 
21
15
  async fetchPermissions(): Promise<any> {
22
16
  const url = '/api/permissions'
@@ -30,28 +24,28 @@ class RoleRestProvider implements IRoleProvider {
30
24
  return role
31
25
  }
32
26
 
33
- async createRole(data: IRoleBase): Promise<any> {
27
+ async create(data: IRoleBase): Promise<any> {
34
28
  const url = '/api/roles'
35
29
  let role = await this.httpClient.post(url, data)
36
30
  return role
37
31
  }
38
- async editRole(id: string, data: IRoleBase): Promise<IRole> {
32
+ async update(id: string, data: IRoleBase): Promise<IRole> {
39
33
  const url = '/api/roles/' + id
40
34
  let user = await this.httpClient.put(url, data)
41
35
  return user as IRole
42
36
  }
43
37
 
44
- async deleteRole(id: string): Promise<any> {
38
+ async delete(id: string): Promise<any> {
45
39
  const url = '/api/roles/' + id
46
40
  let user = await this.httpClient.delete(url)
47
41
  return user
48
42
  }
49
43
 
50
- async paginateRole(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient<IRole>> {
44
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<IRole>> {
51
45
  const url = '/api/roles'
52
- const params = {page, limit, search}
46
+ const params = {page, limit, orderBy, orderDesc, search}
53
47
  let paginatedRoles = await this.httpClient.get(url, {params})
54
- return paginatedRoles as IPaginateClient<IRole>
48
+ return paginatedRoles as IDraxPaginateResult<IRole>
55
49
 
56
50
  }
57
51
 
@@ -1,6 +1,7 @@
1
- import type {IHttpClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IHttpClient} from '@drax/common-front'
2
2
  import type {ITenantProvider} from "../../interfaces/ITenantProvider.ts";
3
- import type {ITenant} from "../../interfaces/ITenant";
3
+ import type {ITenant, ITenantBase} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
5
 
5
6
  class TenantRestProvider implements ITenantProvider {
6
7
 
@@ -10,13 +11,6 @@ class TenantRestProvider implements ITenantProvider {
10
11
  this.httpClient = httpClient
11
12
  }
12
13
 
13
- setHttpClientToken(token: string): void {
14
- this.httpClient.addHeader('Authorization', `Bearer ${token}`)
15
- }
16
-
17
- removeHttpClientToken(): void {
18
- this.httpClient.removeHeader('Authorization')
19
- }
20
14
 
21
15
 
22
16
  async fetchTenant(): Promise<any> {
@@ -25,28 +19,28 @@ class TenantRestProvider implements ITenantProvider {
25
19
  return tenant
26
20
  }
27
21
 
28
- async createTenant(data: ITenant): Promise<any> {
22
+ async create(data: ITenantBase): Promise<any> {
29
23
  const url = '/api/tenants'
30
24
  let tenant = await this.httpClient.post(url, data)
31
25
  return tenant
32
26
  }
33
- async editTenant(id: string, data: ITenant): Promise<ITenant> {
27
+ async update(id: string, data: ITenantBase): Promise<ITenant> {
34
28
  const url = '/api/tenants/' + id
35
29
  let user = await this.httpClient.put(url, data)
36
30
  return user as ITenant
37
31
  }
38
32
 
39
- async deleteTenant(id: string): Promise<any> {
33
+ async delete(id: string): Promise<any> {
40
34
  const url = '/api/tenants/' + id
41
35
  let user = await this.httpClient.delete(url)
42
36
  return user
43
37
  }
44
38
 
45
- async paginateTenant(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient<ITenant>> {
39
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<ITenant>> {
46
40
  const url = '/api/tenants'
47
- const params = {page, limit, search}
41
+ const params = {page, limit, orderBy, orderDesc, search}
48
42
  let paginatedTenants = await this.httpClient.get(url, {params})
49
- return paginatedTenants as IPaginateClient<ITenant>
43
+ return paginatedTenants as IDraxPaginateResult<ITenant>
50
44
 
51
45
  }
52
46
 
@@ -1,6 +1,8 @@
1
- import type {IHttpClient, IPaginateClient} from '@drax/common-front'
1
+ import type {IHttpClient} from '@drax/common-front'
2
2
  import type {IUserProvider} from "../../interfaces/IUserProvider.ts";
3
- import type {IUser, IUserCreate, IUserUpdate} from "../../interfaces/IUser.ts";
3
+ import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
4
+ import type {IDraxPaginateResult} from "@drax/common-share";
5
+
4
6
 
5
7
  class UserRestProvider implements IUserProvider {
6
8
 
@@ -10,37 +12,30 @@ class UserRestProvider implements IUserProvider {
10
12
  this.httpClient = httpClient
11
13
  }
12
14
 
13
- setHttpClientToken(token: string): void {
14
- this.httpClient.addHeader('Authorization', `Bearer ${token}`)
15
- }
16
15
 
17
- removeHttpClientToken(): void {
18
- this.httpClient.removeHeader('Authorization')
19
- }
20
-
21
- async createUser(data: IUserCreate): Promise<IUser> {
16
+ async create(data: IUserCreate): Promise<IUser> {
22
17
  const url = '/api/users'
23
18
  let user = await this.httpClient.post(url, data)
24
19
  return user as IUser
25
20
  }
26
21
 
27
- async editUser(id: string, data: IUserUpdate): Promise<IUser> {
22
+ async update(id: string, data: IUserUpdate): Promise<IUser> {
28
23
  const url = '/api/users/' + id
29
24
  let user = await this.httpClient.put(url, data)
30
25
  return user as IUser
31
26
  }
32
27
 
33
- async deleteUser(id: string): Promise<any> {
28
+ async delete(id: string): Promise<any> {
34
29
  const url = '/api/users/' + id
35
30
  let user = await this.httpClient.delete(url)
36
31
  return user
37
32
  }
38
33
 
39
- async paginateUser(page: number = 1, limit: number = 5, search:string = ""): Promise<IPaginateClient<IUser>> {
40
- const url = '/api/users'
41
- const params = {page, limit, search}
34
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<IUser>> {
35
+ const url = '/api/users'
36
+ const params = {page, limit, orderBy, orderDesc, search}
42
37
  let paginatedUsers = await this.httpClient.get(url, {params})
43
- return paginatedUsers as IPaginateClient<IUser>
38
+ return paginatedUsers as IDraxPaginateResult<IUser>
44
39
 
45
40
  }
46
41
 
@@ -1,9 +1,9 @@
1
1
  import type {IRoleProvider} from "../interfaces/IRoleProvider";
2
- import type {IRole, IRoleBase} from "../interfaces/IRole";
3
- import type {IPaginateClient} from "@drax/common-front";
2
+ import type {IRole, IRoleBase} from "@drax/identity-share";
3
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
4
 
5
5
 
6
- class RoleSystem {
6
+ class RoleSystem implements IRoleProvider {
7
7
 
8
8
  _provider: IRoleProvider
9
9
  prototype: string;
@@ -21,20 +21,20 @@ class RoleSystem {
21
21
  return this._provider.fetchPermissions()
22
22
  }
23
23
 
24
- async paginateRole(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<IRole>> {
25
- return this._provider.paginateRole(page, perPage,search)
24
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}): Promise<IDraxPaginateResult<IRole>> {
25
+ return this._provider.paginate({page, limit, orderBy, orderDesc, search})
26
26
  }
27
27
 
28
- async createRole(userPayload: IRoleBase):Promise<IRole> {
29
- return this._provider.createRole(userPayload)
28
+ async create(userPayload: IRoleBase):Promise<IRole> {
29
+ return this._provider.create(userPayload)
30
30
  }
31
31
 
32
- async editRole(id:string, userPayload: IRoleBase):Promise<IRole> {
33
- return this._provider.editRole(id, userPayload)
32
+ async update(id:string, userPayload: IRoleBase):Promise<IRole> {
33
+ return this._provider.update(id, userPayload)
34
34
  }
35
35
 
36
- async deleteRole(id: string):Promise<any> {
37
- return this._provider.deleteRole(id)
36
+ async delete(id: string):Promise<any> {
37
+ return this._provider.delete(id)
38
38
  }
39
39
 
40
40
  }
@@ -1,6 +1,6 @@
1
1
  import type {ITenantProvider} from "../interfaces/ITenantProvider";
2
- import type {ITenant, ITenantBase} from "../interfaces/ITenant";
3
- import type {IPaginateClient} from "@drax/common-front";
2
+ import type {ITenant, ITenantBase} from "@drax/identity-share";
3
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
4
 
5
5
 
6
6
  class TenantSystem {
@@ -17,20 +17,20 @@ class TenantSystem {
17
17
  return this._provider.fetchTenant()
18
18
  }
19
19
 
20
- async paginateTenant(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<ITenant>> {
21
- return this._provider.paginateTenant(page, perPage,search)
20
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}):Promise<IDraxPaginateResult<ITenant>> {
21
+ return this._provider.paginate({page, limit, orderBy, orderDesc, search})
22
22
  }
23
23
 
24
- async createTenant(userPayload: ITenantBase):Promise<ITenant> {
25
- return this._provider.createTenant(userPayload)
24
+ async create(userPayload: ITenantBase):Promise<ITenant> {
25
+ return this._provider.create(userPayload)
26
26
  }
27
27
 
28
- async editTenant(id:string, userPayload: ITenantBase):Promise<ITenant> {
29
- return this._provider.editTenant(id, userPayload)
28
+ async update(id:string, userPayload: ITenantBase):Promise<ITenant> {
29
+ return this._provider.update(id, userPayload)
30
30
  }
31
31
 
32
- async deleteTenant(id: string):Promise<any> {
33
- return this._provider.deleteTenant(id)
32
+ async delete(id: string):Promise<any> {
33
+ return this._provider.delete(id)
34
34
  }
35
35
 
36
36
  }
@@ -1,6 +1,6 @@
1
1
  import type {IUserProvider} from "../interfaces/IUserProvider";
2
- import type {IUser, IUserCreate, IUserUpdate} from "../interfaces/IUser";
3
- import type {IPaginateClient} from "@drax/common-front";
2
+ import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
3
+ import type {IDraxPaginateResult} from "@drax/common-share";
4
4
 
5
5
 
6
6
  class UserSystem {
@@ -13,16 +13,16 @@ class UserSystem {
13
13
  this.prototype = 'UserSystem'
14
14
  }
15
15
 
16
- async paginateUser(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<IUser>> {
17
- return this._provider.paginateUser(page, perPage, search)
16
+ async paginate({page= 1, limit= 5, orderBy="", orderDesc=false, search = ""}):Promise<IDraxPaginateResult<IUser>> {
17
+ return this._provider.paginate({page, limit, orderBy, orderDesc, search})
18
18
  }
19
19
 
20
- async createUser(userPayload: IUserCreate):Promise<IUser> {
21
- return this._provider.createUser(userPayload)
20
+ async create(userPayload: IUserCreate):Promise<IUser> {
21
+ return this._provider.create(userPayload)
22
22
  }
23
23
 
24
- async editUser(id:string, userPayload: IUserUpdate):Promise<IUser> {
25
- return this._provider.editUser(id, userPayload)
24
+ async update(id:string, userPayload: IUserUpdate):Promise<IUser> {
25
+ return this._provider.update(id, userPayload)
26
26
  }
27
27
 
28
28
  async changeUserPassword(userId:string, newPassword:string):Promise<boolean> {
@@ -31,8 +31,8 @@ class UserSystem {
31
31
  return result
32
32
  }
33
33
 
34
- async deleteUser(id: string):Promise<any> {
35
- return this._provider.deleteUser(id)
34
+ async delete(id: string):Promise<any> {
35
+ return this._provider.delete(id)
36
36
  }
37
37
 
38
38
  }
@@ -1,19 +0,0 @@
1
- interface IRoleBase{
2
- name: string
3
- permissions: string[]
4
- childRoles: string[]
5
- readonly: boolean
6
- }
7
-
8
- interface IRole{
9
- id : string
10
- name: string
11
- permissions: string[]
12
- childRoles: IRole[]
13
- readonly: boolean
14
- }
15
-
16
-
17
-
18
-
19
- export type {IRole, IRoleBase}
@@ -1,11 +0,0 @@
1
- interface ITenantBase{
2
- name: string
3
- }
4
-
5
- interface ITenant extends ITenantBase{
6
- id: string
7
- name: string
8
- }
9
-
10
-
11
- export type {ITenant, ITenantBase}
@@ -1,42 +0,0 @@
1
- import type {IRole} from "./IRole";
2
- import type {ITenant} from "./ITenant";
3
-
4
- interface IUser {
5
- id: string
6
- name: string
7
- username: string
8
- email: string
9
- active: boolean
10
- phone: string
11
- avatar: string
12
- role: IRole
13
- tenant: ITenant
14
- }
15
-
16
- interface IUserCreate {
17
- name: string
18
- username: string
19
- password: string
20
- email: string
21
- active: boolean
22
- phone: string
23
- role: string
24
- tenant: string
25
- }
26
-
27
- interface IUserUpdate {
28
- name: string
29
- username: string
30
- email: string
31
- active: boolean
32
- phone: string
33
- role: string|undefined
34
- tenant: string|undefined
35
- }
36
-
37
- interface IUserPassword {
38
- newPassword: string
39
- confirmPassword: string
40
- }
41
-
42
- export type {IUser, IUserCreate, IUserUpdate, IUserPassword}