src/controllers/accommodation.controller.js
/**
   * @description This helps a super admin to approve an accommodation
   * request created by a host-supplier
   * @param  {object} req - The accommodation object
   * @param  {object} res - The response object
   * @returns  {object} The response object
   */
@description This helps a super admin to approve an accommodation
request created by a host-supplier
@param  {object} req - The accommodation object
@param  {object} res - The response object
@returns  {object} The response object
@description This helps a super admin to approve an accommodation request created by a host - supplier @param { object } req - The accommodation object @param { object } res - The response object @returns { object } The response object
static async accommodationApprove(req, res) {
    try {
      const id = parseInt(req.params.id, 10);
      let response;
      const accommodationFound = await AccommodationRepository.findById(id);
      if (!accommodationFound) {
        response = new Response(res, 404, 'No Accommodation found');
        return response.sendErrorMessage();
      }
      const approvedAccommodation = await AccommodationRepository.accommodationApprove(
        { id },
        { status: 'Approved' }
      );
      response = new Response(
        res,
        200,
        'Accommodation is sucessfully approved',
        approvedAccommodation[1]
      );
      return response.sendSuccessResponse();
    } catch (error) {
      return DbErrorHandler.handleSignupError(res, error);
    }
  }
static async accommodationApprove ( req , res ) { try { const id = parseInt ( req . params . id , 10 ) ; let response ; const accommodationFound = await AccommodationRepository . findById ( id ) ; if ( ! accommodationFound ) { response = new Response ( res , 404 , 'No Accommodation found' ) ; return response . sendErrorMessage ( ) ; } const approvedAccommodation = await AccommodationRepository . accommodationApprove ( { id } , { status : 'Approved' } ) ; response = new Response ( res , 200 , 'Accommodation is sucessfully approved' , approvedAccommodation [ 1 ] ) ; return response . sendSuccessResponse ( ) ; } catch ( error ) { return DbErrorHandler . handleSignupError ( res , error ) ; } }
@description This helps a super admin to approve an accommodation
 request created by a host-supplier
 @param  {object} req - The accommodation object
 @param  {object} res - The response object
 @returns  {object} The response object
@description This helps a super admin to approve an accommodation request created by a host - supplier @param { object } req - The accommodation object @param { object } res - The response object @returns { object } The response object