'use strict'; const { Model } = require('sequelize'); const order = require('./order'); module.exports = (sequelize, DataTypes) => { class orderDetails extends Model { /** * Helper method for defining associations. * This method is not a part of Sequelize lifecycle. * The `models/index` file will call this method automatically. */ static associate(models) { // define association here models.order.hasMany(models.orderDetails); models.orderDetails.belongsTo(models.medicines); //models.orderDetails.belongsTo(models.users); //models.orderDetails.belongsTo(models.order); } } orderDetails.init({ orderId: DataTypes.INTEGER, medicineId: DataTypes.INTEGER, quantity: DataTypes.INTEGER, amount: DataTypes.DOUBLE, curdiscount: DataTypes.DOUBLE, discount: DataTypes.DOUBLE, total: DataTypes.DOUBLE, status: DataTypes.INTEGER, createdBy: DataTypes.INTEGER, updatedBy: DataTypes.INTEGER }, { sequelize, modelName: 'orderDetails', }); return orderDetails; };