@itleanchatbot/shared-models-js-postgres 1.0.11 → 1.0.12

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/index.js CHANGED
@@ -28,6 +28,7 @@ const systemUsers = require('./src/systemUsers')
28
28
  const transhipConversations = require('./src/transhipConversations')
29
29
  const quickMessages = require('./src/quickMessages')
30
30
  const lineConfigurations = require('./src/lineConfigurations')
31
+ const permissions = require('./src/permissions')
31
32
 
32
33
  module.exports = {
33
34
  attendances,
@@ -59,5 +60,6 @@ module.exports = {
59
60
  systemUsers,
60
61
  transhipConversations,
61
62
  quickMessages,
62
- lineConfigurations
63
+ lineConfigurations,
64
+ permissions
63
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -0,0 +1,28 @@
1
+ exports.PermissionsModel = (sequelize, DataTypes) => {
2
+ const Permissions = sequelize.define('Permissions', {
3
+ permissionCode: {
4
+ type: DataTypes.STRING(50),
5
+ allowNull: false,
6
+ unique: true,
7
+ validate: {
8
+ notEmpty: true,
9
+ },
10
+ },
11
+ description: {
12
+ allowNull: false,
13
+ type: DataTypes.STRING(255),
14
+ validate: {
15
+ notEmpty: true,
16
+ },
17
+ },
18
+ })
19
+
20
+ Permissions.associate = (models) => {
21
+ Permissions.belongsToMany(models.Profiles, {
22
+ through: models.Profiles_Permissions,
23
+ })
24
+ }
25
+
26
+ return Permissions
27
+ }
28
+