Spaces:
Runtime error
Runtime error
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; | |