text: import HttpStatus from 'http-status-codes';
  
  import * as sectorService from '../services/sectorService';
  
  /**
   * Get all sector.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
  export function fetchAll(req, res, next) {
    sectorService
      .getAllSector()
      .then(data => res.json({ data }))
      .catch(err => next(err));
  }
  
  /**
   * Get a sector by its id.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
  export function fetchById(req, res, next) {
    sectorService
      .getSector(req.params.id)
      .then(data => res.json({ data }))
      .catch(err => next(err));
  }
  
  /**
   * Create a new Sector.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
  export function create(req, res, next) {
    sectorService
      .createSector(req.body)
      .then(data => res.status(HttpStatus.CREATED).json({ data }))
      .catch(err => next(err));
  }
  
  /**
   * Update a Property Type.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
  export function update(req, res, next) {
    sectorService
      .updateSector(req.params.id, req.body)
      .then(data => res.json({ data }))
      .catch(err => next(err));
  }
  
  /**
   * Delete a property type.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
  export function deleteUser(req, res, next) {
    sectorService
      .deleteSector(req.params.id)
      .then(data => res.status(HttpStatus.NO_CONTENT).json({ data }))
      .catch(err => next(err));
  }
  