const mongoose = require("mongoose");
const User = mongoose.model("User");
const SellingPartnerAPI = require('amazon-sp-api');


exports.Login = async (req,res) => {
  return res.status(200).json({
        success: true,
        result: [],     
        message: "Seller Match",
      });
};
exports.customersSettingUpdate = async (req, res) => {
  let _id = req.body._id;

  const customer= await User.findOne({ _id: _id });
  if (!customer) {
    return res.status(400).json({
      Response: { status: 400, msg: "Invalid customer" },
    });
  }

  let updateObj = { 
    address: req.body.address,
    phoneNo: req.body.phoneNo,
    pincode: req.body.pincode,
    country: req.body.country,
    state: req.body.state,
    city: req.body.city,
  };
  
  try {   
   await User.updateOne(
      { _id: mongoose.Types.ObjectId(_id) },
      { $set: updateObj },  
      { upsert: false }
    )
      .exec()
      .then(() => {
        res.send({ error: 0, response: "Record updated successfully." });
      });
  } catch (err) {
    res.send({ error: 1, response: "Something went wrong." });
  }
};
