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, InferCreationAttributes> implements PermissionInterface { declare id: CreationOptional; 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;