function validateImage(file) {
  if (!file) throw new Error("No file uploaded")
  if (!["image/jpeg", "image/jpg"].includes(file.mimetype))
    throw new Error("Only JPEG allowed")
  if (file.size > 2 * 1024 * 1024)
    throw new Error("File too large")
}
module.exports = { validateImage }
