@tomei/sso 0.60.2 → 0.60.4-dev.1

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.
@@ -5,10 +5,11 @@ module.exports = {
5
5
  async up(queryInterface, Sequelize) {
6
6
  await queryInterface.createTable('sso_UserPasswordHistory', {
7
7
  HistoryId: {
8
- type: Sequelize.INTEGER,
9
- autoIncrement: true,
8
+ type: Sequelize.STRING(30),
10
9
  primaryKey: true,
11
10
  allowNull: false,
11
+ onUpdate: 'CASCADE',
12
+ onDelete: 'CASCADE',
12
13
  },
13
14
  UserId: {
14
15
  type: Sequelize.INTEGER,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.60.2",
3
+ "version": "0.60.4-dev.1",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1504,7 +1504,7 @@ export class User extends UserBase {
1504
1504
  await UserPasswordHistory.create(
1505
1505
  dbTransaction,
1506
1506
  parseInt(userId),
1507
- userData.Password,
1507
+ user._Password,
1508
1508
  );
1509
1509
  } catch (error) {
1510
1510
  throw error;
@@ -24,7 +24,7 @@ export class UserPasswordHistoryRepository
24
24
  }
25
25
 
26
26
  async destroyMultiple(
27
- HistoryIdList: number[],
27
+ HistoryIdList: string[],
28
28
  dbTransaction: any,
29
29
  ): Promise<void> {
30
30
  await UserPasswordHistoryModel.destroy({
@@ -18,12 +18,12 @@ export class UserPasswordHistory
18
18
 
19
19
  private static _Repo = new UserPasswordHistoryRepository();
20
20
 
21
- get HistoryId(): number {
22
- return parseInt(this.ObjectId);
21
+ get HistoryId(): string {
22
+ return this.ObjectId;
23
23
  }
24
24
 
25
- set HistoryId(value: number) {
26
- this.ObjectId = value.toString();
25
+ set HistoryId(value: string) {
26
+ this.ObjectId = value;
27
27
  }
28
28
 
29
29
  get CreatedAt(): Date {
@@ -33,7 +33,7 @@ export class UserPasswordHistory
33
33
  private constructor(params?: IUserPasswordHistoryAttr) {
34
34
  super();
35
35
  if (params) {
36
- this.ObjectId = params.HistoryId.toString();
36
+ this.ObjectId = params.HistoryId;
37
37
  this.UserId = params.UserId;
38
38
  this.PasswordHash = params.PasswordHash;
39
39
  this._CreatedAt = params.CreatedAt;
@@ -149,8 +149,10 @@ export class UserPasswordHistory
149
149
  ) || 3;
150
150
 
151
151
  // Part 3: Insert new password history by calling class _repo create() method.
152
+ const userPasswordHistory = new UserPasswordHistory();
152
153
  let passwordHistory = await UserPasswordHistory._Repo.create(
153
154
  {
155
+ HistoryId: userPasswordHistory.createId(),
154
156
  UserId: UserId,
155
157
  PasswordHash: PasswordHash,
156
158
  },
@@ -1,5 +1,5 @@
1
1
  export interface IUserPasswordHistoryAttr {
2
- HistoryId: number;
2
+ HistoryId: string;
3
3
  UserId: number;
4
4
  PasswordHash: string;
5
5
  CreatedAt: Date;
@@ -23,10 +23,9 @@ export default class UserPasswordHistoryModel
23
23
  @Column({
24
24
  primaryKey: true,
25
25
  allowNull: false,
26
- type: DataType.INTEGER,
27
- autoIncrement: true,
26
+ type: DataType.STRING(30),
28
27
  })
29
- HistoryId: number;
28
+ HistoryId: string;
30
29
 
31
30
  @ForeignKey(() => User)
32
31
  @Column({