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,6 +4,7 @@ import { AuracleDatabaseDriver } from "../../AuracleDatabaseDriver";
interface IngredientAttributes {
id: number
uuid: string
name: string
description: string
@@ -12,8 +13,9 @@ interface IngredientAttributes {
interface IngredientCreationAttributes extends Optional<IngredientAttributes, 'id'> { }
class Ingredient extends Model<IngredientAttributes, IngredientCreationAttributes> implements IngredientAttributes {
public id!: number
export class Ingredient extends Model<IngredientAttributes, IngredientCreationAttributes> implements IngredientAttributes {
public readonly id!: number
public readonly uuid!: string
public name!: string
public description!: string
@@ -31,6 +33,11 @@ export default () => {
autoIncrement: true,
primaryKey: true
},
uuid: {
type: DataTypes.UUIDV4,
allowNull: false,
unique: true
},
name: {
type: DataTypes.STRING,
allowNull: false,