src/services/ammoinventory.service.js
/**
   * Reads all inventory items for a caliber for a single user from the DB.
   *
   * @param {*} userId
   * @returns
   */
Reads all inventory items for a caliber for a single user from the DB.
@param {*} userId
@returns
Reads all inventory items for a caliber for a single user from the DB . @param { * } userId @returns
static async allForCaliber(userId, caliber) {
    try {
      return await AmmoInventory.findAll({
        where: {
          userId: {
            [Op.eq]: userId,
          },
          caliber: {
            [Op.eq]: caliber,
          },
        },
        include: ['ammo', 'history'],
        order: [['brand', 'ASC']],
      });
    } catch (error) {
      throw error;
    }
  }
static async allForCaliber ( userId , caliber ) { try { return await AmmoInventory . findAll ( { where : { userId : { [ Op . eq ] : userId , } , caliber : { [ Op . eq ] : caliber , } , } , include : [ 'ammo' , 'history' ] , order : [ [ 'brand' , 'ASC' ] ] , } ) ; } catch ( error ) { throw error ; } }
Reads all inventory items for a caliber for a single user from the DB.
Reads all inventory items for a caliber for a single user from the DB .