"use strict";
const db = require("../../models/index");
const sequelize = require("sequelize");

const bulkUpsertPriceHistory = async priceHistoryData => {
  try {
    const order = [["realEstateId", "desc"]];

    return await db.PriceHistory.bulkCreate(priceHistoryData, {
      order,
      ignoreDuplicates: true
    });
  } catch (e) {
    console.log("Error bulk upserting priceHistory : ", e);
  }
};

module.exports = {
  bulkUpsertPriceHistory
};
