@tomei/sso 0.60.4-dev.4 → 0.60.4-dev.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.60.4-dev.4",
3
+ "version": "0.60.4-dev.6",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,2 +1,2 @@
1
- export * from './login-history';
2
1
  export * from './login-history.repository';
2
+ export * from './login-history';
@@ -5,6 +5,7 @@ import { LoginUser } from '../login-user/login-user';
5
5
  import { ApplicationConfig } from '@tomei/config';
6
6
  import { ILoginHistorySearchAttr } from '../../interfaces/login-history-search-attr.interface';
7
7
  import { Op } from 'sequelize';
8
+ import User from '../../models/user.entity';
8
9
 
9
10
  export class LoginHistory extends ObjectBase {
10
11
  ObjectId: string;
@@ -14,6 +15,7 @@ export class LoginHistory extends ObjectBase {
14
15
 
15
16
  HistoryId: number;
16
17
  UserId: number;
18
+ UserName: string;
17
19
  OriginIP: string;
18
20
  SystemCode: string;
19
21
  LoginStatus: string;
@@ -27,12 +29,13 @@ export class LoginHistory extends ObjectBase {
27
29
  private constructor(loginHistoryAttr?: ILoginHistoryAttr) {
28
30
  super();
29
31
  if (loginHistoryAttr) {
30
- this.HistoryId = loginHistoryAttr.HistoryId;
31
- this.UserId = loginHistoryAttr.UserId;
32
+ this.HistoryId = loginHistoryAttr?.HistoryId;
33
+ this.UserId = loginHistoryAttr?.UserId;
34
+ this.UserName = loginHistoryAttr?.User?.UserName;
32
35
  this.OriginIP = loginHistoryAttr?.OriginIp;
33
36
  this.SystemCode = loginHistoryAttr?.SystemCode;
34
37
  this.LoginStatus = loginHistoryAttr?.LoginStatus;
35
- this._CreatedAt = loginHistoryAttr.CreatedAt;
38
+ this._CreatedAt = loginHistoryAttr?.CreatedAt;
36
39
  }
37
40
  }
38
41
 
@@ -96,6 +99,13 @@ export class LoginHistory extends ObjectBase {
96
99
  where: queryObj,
97
100
  ...whereObj,
98
101
  order: [['CreatedAt', 'DESC']],
102
+ include: [
103
+ {
104
+ model: User,
105
+ required: false,
106
+ attributes: ['UserName'],
107
+ },
108
+ ],
99
109
  transaction: dbTransaction,
100
110
  });
101
111
 
@@ -249,7 +249,7 @@ export class UserSystemAccess extends ObjectBase {
249
249
  Status: UserStatus.ACTIVE,
250
250
  },
251
251
  as: 'User',
252
- attributes: ['UserId', 'FullName'],
252
+ attributes: ['UserId', 'FullName', 'Email'],
253
253
  },
254
254
  ],
255
255
  };
@@ -1,6 +1,9 @@
1
1
  export interface ILoginHistoryAttr {
2
2
  HistoryId: number;
3
3
  UserId: number;
4
+ User?: {
5
+ UserName: string;
6
+ };
4
7
  OriginIp: string;
5
8
  SystemCode: string;
6
9
  LoginStatus: string;