Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
SOD/models/command.js

37 lines
782 B
JavaScript
Raw Normal View History

2020-08-15 12:36:20 +02:00
"use strict";
const {
Model
} = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Command extends Model {
static associate(models) {
Command.belongsToMany(models.Sandwich, {through: {model: models.SandwichCommand, unique: false}});
2020-08-15 12:36:20 +02:00
Command.belongsTo(models.Department);
Command.belongsTo(models.User);
2020-08-15 12:36:20 +02:00
}
}
Command.init({
firstName: {
type: DataTypes.STRING,
allowNull: false
},
lastName: {
type: DataTypes.STRING,
allowNull: false
},
date: {
type: DataTypes.DATE,
2020-08-15 12:36:20 +02:00
defaultValue: DataTypes.NOW,
allowNull: false
},
price: {
type: DataTypes.FLOAT,
allowNull: false
2020-08-15 12:36:20 +02:00
}
}, {
sequelize,
modelName: "Command",
});
return Command;
};