@tomei/sso 0.50.1 → 0.50.3

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.
@@ -9,7 +9,7 @@ module.exports = {
9
9
  allowNull: false,
10
10
  },
11
11
  PrivilegeCode: {
12
- type: Sequelize.STRING(50),
12
+ type: Sequelize.STRING(200),
13
13
  allowNull: false,
14
14
  },
15
15
  SystemCode: {
@@ -21,7 +21,7 @@ module.exports = {
21
21
  onUpdate: 'CASCADE',
22
22
  },
23
23
  SystemPrivilegeId: {
24
- type: Sequelize.STRING(10),
24
+ type: Sequelize.STRING(30),
25
25
  allowNull: false,
26
26
  references: {
27
27
  model: 'sso_SystemPrivilege',
@@ -52,7 +52,9 @@ module.exports = {
52
52
  },
53
53
  UpdatedAt: {
54
54
  allowNull: false,
55
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)'),
55
+ defaultValue: Sequelize.literal(
56
+ 'CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)',
57
+ ),
56
58
  type: Sequelize.DATE,
57
59
  },
58
60
  UpdatedById: {
@@ -65,11 +67,10 @@ module.exports = {
65
67
  onDelete: 'CASCADE',
66
68
  onUpdate: 'CASCADE',
67
69
  },
68
-
69
70
  });
70
71
  },
71
72
 
72
73
  async down(queryInterface, Sequelize) {
73
74
  await queryInterface.dropTable('sso_UserPrivilege');
74
- }
75
+ },
75
76
  };
@@ -21,7 +21,7 @@ module.exports = {
21
21
  onUpdate: 'CASCADE',
22
22
  },
23
23
  SystemPrivilegeId: {
24
- type: Sequelize.STRING(10),
24
+ type: Sequelize.STRING(30),
25
25
  allowNull: false,
26
26
  references: {
27
27
  model: 'sso_SystemPrivilege',
@@ -62,7 +62,9 @@ module.exports = {
62
62
  },
63
63
  UpdatedAt: {
64
64
  allowNull: false,
65
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)'),
65
+ defaultValue: Sequelize.literal(
66
+ 'CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)',
67
+ ),
66
68
  type: Sequelize.DATE,
67
69
  },
68
70
  UpdatedById: {
@@ -75,11 +77,10 @@ module.exports = {
75
77
  onDelete: 'CASCADE',
76
78
  onUpdate: 'CASCADE',
77
79
  },
78
-
79
80
  });
80
81
  },
81
82
 
82
83
  async down(queryInterface, Sequelize) {
83
84
  await queryInterface.dropTable('sso_GroupPrivilege');
84
- }
85
+ },
85
86
  };
@@ -21,7 +21,7 @@ module.exports = {
21
21
  onUpdate: 'CASCADE',
22
22
  },
23
23
  SystemPrivilegeId: {
24
- type: Sequelize.STRING(10),
24
+ type: Sequelize.STRING(30),
25
25
  allowNull: false,
26
26
  references: {
27
27
  model: 'sso_SystemPrivilege',
@@ -21,7 +21,7 @@ module.exports = {
21
21
  onUpdate: 'CASCADE',
22
22
  },
23
23
  SystemPrivilegeId: {
24
- type: Sequelize.STRING(10),
24
+ type: Sequelize.STRING(30),
25
25
  allowNull: false,
26
26
  references: {
27
27
  model: 'sso_SystemPrivilege',
@@ -60,7 +60,9 @@ module.exports = {
60
60
  },
61
61
  UpdatedAt: {
62
62
  allowNull: false,
63
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)'),
63
+ defaultValue: Sequelize.literal(
64
+ 'CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)',
65
+ ),
64
66
  type: Sequelize.DATE,
65
67
  },
66
68
  UpdatedById: {
@@ -73,11 +75,10 @@ module.exports = {
73
75
  onDelete: 'CASCADE',
74
76
  onUpdate: 'CASCADE',
75
77
  },
76
-
77
78
  });
78
79
  },
79
80
 
80
81
  async down(queryInterface, Sequelize) {
81
82
  await queryInterface.dropTable('sso_UserObjectPrivilege');
82
- }
83
+ },
83
84
  };
@@ -0,0 +1,102 @@
1
+ 'use strict';
2
+
3
+ /** @type {import('sequelize-cli').Migration} */
4
+ module.exports = {
5
+ up: async (queryInterface, Sequelize) => {
6
+ await queryInterface.createTable('sso_Building', {
7
+ GroupCode: {
8
+ type: Sequelize.STRING(10),
9
+ primaryKey: true,
10
+ allowNull: false,
11
+ references: {
12
+ model: 'sso_Group',
13
+ key: 'GroupCode',
14
+ },
15
+ onUpdate: 'CASCADE',
16
+ onDelete: 'CASCADE',
17
+ },
18
+ BuildingType: {
19
+ type: Sequelize.ENUM('Outlet', 'Office'),
20
+ allowNull: true,
21
+ },
22
+ Email: {
23
+ type: Sequelize.STRING(200),
24
+ allowNull: true,
25
+ },
26
+ Mobile: {
27
+ type: Sequelize.STRING(20),
28
+ allowNull: true,
29
+ },
30
+ Phone: {
31
+ type: Sequelize.STRING(20),
32
+ allowNull: false,
33
+ },
34
+ Brand: {
35
+ type: Sequelize.STRING(10),
36
+ allowNull: true,
37
+ },
38
+ OpeningDate: {
39
+ type: Sequelize.DATE,
40
+ allowNull: true,
41
+ },
42
+ CeasedDate: {
43
+ type: Sequelize.DATE,
44
+ allowNull: true,
45
+ },
46
+ OpeningHours: {
47
+ type: Sequelize.STRING(200),
48
+ allowNull: true,
49
+ },
50
+ CreatedById: {
51
+ type: Sequelize.INTEGER,
52
+ allowNull: true,
53
+ references: {
54
+ model: 'sso_User',
55
+ key: 'UserId',
56
+ },
57
+ onDelete: 'CASCADE',
58
+ onUpdate: 'CASCADE',
59
+ },
60
+ CreatedAt: {
61
+ allowNull: false,
62
+ defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
63
+ type: Sequelize.DATE,
64
+ },
65
+ UpdatedById: {
66
+ type: Sequelize.INTEGER,
67
+ allowNull: true,
68
+ references: {
69
+ model: 'sso_User',
70
+ key: 'UserId',
71
+ },
72
+ onDelete: 'CASCADE',
73
+ onUpdate: 'CASCADE',
74
+ },
75
+ UpdatedAt: {
76
+ allowNull: false,
77
+ defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
78
+ type: Sequelize.DATE,
79
+ },
80
+ });
81
+
82
+ // Add a trigger to keep GroupCode and ObjectId in sync on updates
83
+ await queryInterface.sequelize.query(`
84
+ CREATE TRIGGER update_GroupCode_ObjectId
85
+ BEFORE UPDATE ON sso_Building
86
+ FOR EACH ROW
87
+ BEGIN
88
+ IF NEW.ObjectId != OLD.ObjectId THEN
89
+ SET NEW.GroupCode = NEW.ObjectId;
90
+ END IF;
91
+ END;
92
+ `);
93
+ },
94
+
95
+ down: async (queryInterface, Sequelize) => {
96
+ // Drop the trigger before dropping the table
97
+ await queryInterface.sequelize.query(
98
+ `DROP TRIGGER IF EXISTS update_GroupCode_ObjectId`,
99
+ );
100
+ await queryInterface.dropTable('sso_Building');
101
+ },
102
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.50.1",
3
+ "version": "0.50.3",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {