text: const deliveryServices = require('../services/delivery.services')
  
  const postSubmitDeliveryRequest = (req, res, next) => {
    deliveryServices
      .createDeliveryItems(req)
      .then((response) => {
        res.json(response)
      })
      .catch((error) => {
        next(error)
      })
  }
  
  const postAddCourierToDeliverItem = (req, res, next) => {
    deliveryServices
      .assignUserToDeliver(req)
      .then((response) => res.status(response.code || 200).json(response))
      .catch((err) => next(err))
  }
  
  const postDeliveryLogs = (req, res, next) => {
    deliveryServices
      .addDeliveryLogs(req)
      .then((response) => res.status(response.code || 200).json(response))
      .catch((err) => next(err))
  }
  
  const getAllDeliveryServices = (req, res, next) => {
    deliveryServices
      .findAllDeliveryServices(req)
      .then((response) => res.status(response.code || 200).json(response))
      .catch((error) => next(error))
  }
  
  const getDeliveryServicesById = (req, res, next) => {
    deliveryServices
      .findDeliveryServicesById(req)
      .then((response) => res.status(response.code || 200).json(response))
      .catch((err) => next(err))
  }
  
  const getScheduleTime = (req, res, next) => {
    deliveryServices
      .checkScheduleByDate(req)
      .then((response) => res.status(response.code || 200).json(response))
      .catch((err) => next(err))
  }
  
  const putDeliveryServicesById = (req, res, next) => {
    deliveryServices
      .updateDeliveryServicesById(req)
      .then((result) => {
        res.status(result.code).json(result)
      })
      .catch((err) => {
        next(err)
      })
  }
  
  const getAllServicesLogsByDeliveryId = (req, res, next) => {
    deliveryServices
      .findAllLogsDelivery(req)
      .then((result) => {
        res.status(result.code).json(result)
      })
      .catch((err) => {
        next(err)
      })
  }
  
  module.exports = {
    postSubmitDeliveryRequest,
    postAddCourierToDeliverItem,
    postDeliveryLogs,
    getAllDeliveryServices,
    getDeliveryServicesById,
    getScheduleTime,
    putDeliveryServicesById,
    getAllServicesLogsByDeliveryId,
  }
  