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.
32 lines
976 B
JavaScript
32 lines
976 B
JavaScript
10 months ago
|
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);
|
||
|
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();
|