DEV Community

Oussama Heloulou
Oussama Heloulou

Posted on

Get the sum of quantities grouped by an Id that is not in the current table

I have three models that look something like this:

const Reagent = sequelize.define('reagent', {
    name: {
      type: DataTypes.STRING
      allowNull: false,
    },
    ...
  })
  const Box = sequelize.define('box', {
    code: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: true,
    },
    quantity: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    ...
  })

  const BoxActivity = sequelize.define('boxActivity',

Top comments (0)