gemcap-be-common 1.4.9 → 1.4.11

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.
@@ -22,10 +22,13 @@ export interface IUser extends IUserBasic, IUserAccess {
22
22
  isEnabled?: boolean;
23
23
  lastLogin?: Date | null;
24
24
  }
25
- export interface IRole {
25
+ export interface IUserRole {
26
26
  id: string;
27
27
  name: string;
28
28
  representation: string;
29
29
  createdAt?: Date;
30
30
  updatedAt?: Date;
31
31
  }
32
+ export interface IGroupedUserRoles {
33
+ [module: string]: IUserRole[];
34
+ }
@@ -25,7 +25,7 @@ export interface IUser extends IUserBasic, IUserAccess {
25
25
  lastLogin?: Date | null;
26
26
  }
27
27
 
28
- export interface IRole {
28
+ export interface IUserRole {
29
29
  id: string;
30
30
  name: string;
31
31
  representation: string;
@@ -33,3 +33,6 @@ export interface IRole {
33
33
  updatedAt?: Date;
34
34
  }
35
35
 
36
+ export interface IGroupedUserRoles {
37
+ [module: string]: IUserRole[];
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@ export declare class ComplianceBorrowersService {
45
45
  };
46
46
  };
47
47
  getFullComplianceBorrowerById(complianceBorrowerId: string): Promise<any>;
48
- getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "items" | "borrower" | "fundingStatus"> | {
48
+ getAllBorrowersShortened(userAccess: any): Promise<(Pick<IComplianceBorrowerDocument, "borrower" | "fundingStatus" | "items"> | {
49
49
  items: {
50
50
  instances: any[];
51
51
  item: import("../models/ComplianceItem.model").IComplianceItemDocument;
@@ -24,24 +24,20 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  import express from 'express';
27
- import { IRole, IUser, IUserAccess } from '../interfaces/auth-user.interface';
28
- interface IKeycloakConfig {
29
- keycloakHost: string;
30
- realm: string;
31
- adminUser: string;
32
- adminPass: string;
27
+ import { IUserRole, IUser, IUserAccess } from '../interfaces/auth-user.interface';
28
+ interface IAuthConfig {
33
29
  baseUrl: string;
34
30
  }
35
31
  export declare class UsersService {
36
32
  private readonly config;
37
- constructor(config: IKeycloakConfig);
33
+ constructor(config: IAuthConfig);
38
34
  getUserAccessByRequest(req: express.Request): Promise<IUser | null>;
39
35
  getUserById(userId: string): Promise<IUser>;
40
36
  getUserByUsername(username: string): Promise<IUser>;
41
37
  getUserByToken(req: express.Request): Promise<IUser>;
42
38
  getUserIdByToken(req: express.Request): Promise<string>;
43
39
  getUserList(): Promise<IUser[]>;
44
- getAllRoles(): Promise<IRole[]>;
40
+ getAllRoles(): Promise<IUserRole[]>;
45
41
  getUserRoles(userId: string): Promise<string[]>;
46
42
  updateMobileUser(userId: string, keyValue: {
47
43
  [key: string]: string | number | boolean;
@@ -5,20 +5,16 @@ import axios from 'axios';
5
5
  import { BorrowerCompliance } from '../models/BorrowerCompliance.model';
6
6
  import { UserMobileAccess } from '../models/UserMobileAccess.model';
7
7
  import { UserLog } from '../models/UserLog.model';
8
- import { IRole, IUser, IUserAccess } from '../interfaces/auth-user.interface';
8
+ import { IUserRole, IUser, IUserAccess } from '../interfaces/auth-user.interface';
9
9
 
10
- interface IKeycloakConfig {
11
- keycloakHost: string;
12
- realm: string;
13
- adminUser: string;
14
- adminPass: string;
10
+ interface IAuthConfig {
15
11
  baseUrl: string;
16
12
  }
17
13
 
18
14
  export class UsersService {
19
- private readonly config: IKeycloakConfig;
15
+ private readonly config: IAuthConfig;
20
16
 
21
- constructor(config: IKeycloakConfig) {
17
+ constructor(config: IAuthConfig) {
22
18
  this.config = config;
23
19
  }
24
20
 
@@ -68,7 +64,7 @@ export class UsersService {
68
64
  }
69
65
 
70
66
  async getAllRoles() {
71
- const { data } = await axios.get<IRole[]>(`${this.config.baseUrl}/users/roles`);
67
+ const { data } = await axios.get<IUserRole[]>(`${this.config.baseUrl}/users/roles`);
72
68
  return data ?? null;
73
69
  }
74
70