Updated db models

This commit is contained in:
Alexis
2021-07-24 22:20:48 +02:00
parent ca9dbbd7db
commit f3bbe696ed
7 changed files with 64 additions and 15 deletions

View File

@@ -4,14 +4,16 @@ import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
interface RoleAttributes {
id: number
uuid: string
name: string
description: string
}
interface RoleCreationAttributes extends Optional<RoleAttributes, 'id'> { }
class Role extends Model<RoleAttributes, RoleCreationAttributes> implements RoleAttributes {
public id!: number
export class Role extends Model<RoleAttributes, RoleCreationAttributes> implements RoleAttributes {
public readonly id!: number
public readonly uuid!: string
public name!: string
public description!: string
@@ -27,6 +29,11 @@ export default () => {
autoIncrement: true,
primaryKey: true
},
uuid: {
type: DataTypes.UUIDV4,
allowNull: false,
unique: true
},
name: {
type: DataTypes.STRING,
allowNull: false,