You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB
JavaScript

const BaseController = require('./BaseController');
const heytripService = require('../services/heytripService');
class Heytrip extends BaseController {
getAids = async (ctx) => {
try {
const { nextPage } = await heytripService.syncAids();
ctx.body = this.response(0, 'get_heytrip_ids', nextPage);
} catch (error) {
// console.error(error);
ctx.body = this.response(1, error.message || 'An error occurred.');
}
};
getHotelInfo = async (ctx) => {
const { data } = await heytripService.syncHotelDetails();
ctx.body = this.response(0, 'get_hotel_info', data);
};
getAvailability = async (ctx) => {
try {
const data = await heytripService.getHotelAvailability(ctx.query);
heytripService.writeHeytripRequestLog({
action: 'heytripAvailability',
body: ctx.query,
});
ctx.body = this.response(0, 'get_hotel_availability', data);
} catch (error) {
ctx.body = this.response(1, error.message || 'An error occurred.');
}
};
}
module.exports = new Heytrip();