File size: 978 Bytes
bdcfb98
 
 
 
 
 
 
 
1f6a8f9
 
2f7395b
 
bdcfb98
fce755d
bdcfb98
785f3a2
bdcfb98
 
 
 
 
 
 
 
 
 
 
785f3a2
bdcfb98
 
 
 
 
 
 
 
 
 
 
 
e30c136
 
bdcfb98
 
 
 
1f6a8f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import {
  DataTypes,
  Model,
  InferAttributes,
  InferCreationAttributes,
  CreationOptional,
} from 'sequelize';

import { sequelize } from './index'; 
import { PermissionInterface } from '../shared/interfaces/permission.interface';
import Role from './roles';
import RolePermission from './rolePermissions';

class Permission extends Model<InferAttributes<Permission>, InferCreationAttributes<Permission>> implements PermissionInterface {
  declare id: CreationOptional<number>;
  declare permission_name: string;
}

Permission.init(
  {
    id: {
      type: DataTypes.INTEGER.UNSIGNED,
      autoIncrement: true,
      primaryKey: true,
      unique: true,
    },

    permission_name: {
      type: DataTypes.STRING,
      allowNull: false,
    },

  },

  {
    sequelize,
    tableName: 'permissions',
    underscored: true,
    freezeTableName: true,
    timestamps: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at',
  }

);

export default Permission;