"use strict";
module.exports = (sequelize, DataTypes) => {
const Command = sequelize.define('Command', {
number: {
type: DataTypes.INTEGER,
allowNull: false,
unique: "uniqueNumberPerDay"
},
price: {
type: DataTypes.FLOAT,
allowNull: false
date: {
type: DataTypes.DATEONLY,
defaultValue: DataTypes.NOW,
take: {
type: DataTypes.DATE,
done: {
type: DataTypes.DATE
give: {
WIP: {
type: DataTypes.BOOLEAN,
defaultValue: false,
error: {
}
}, {
tableName: "Commands"
});
Command.associate = function(models) {
// associations can be defined here
Command.belongsTo(models.User, {
as: "client"
as: "pc"
as: "sandwich"
Command.belongsTo(models.Dish);
Command.belongsToMany(models.Ingredient, {
through: "CommandsIngredients"
Command.belongsToMany(models.Sauce, {
through: "CommandsSauces"
Command.belongsTo(models.Drink);
Command.belongsTo(models.Dessert);
};
return Command;