def getFullItineraryDetails(self, itinerary_id): result = self.dao.getFullItineraryDetails(itinerary_id) if not result: return jsonify(Error="Itinerary Not Found"), 404 else: itinerary = itineraryRepository(result) itinerary = getInfo(itinerary) return jsonify(Itinerary=itinerary)
def getItinerariesByRouteId(self, route_id): result = self.dao.getItinerariesByRouteId(route_id) if not result: return jsonify(Error="Itinerary Not Found"), 404 else: itinerary = itineraryRepository(result) itinerary = getInfo(itinerary) return jsonify(Itinerary=itinerary)
def getItinerariesByEndTime(self, end_time): result_list = self.dao.getItinerariesByEndTime(end_time) itinerary_list = [] if not result_list: return jsonify(Error="Itineraries Not Found"), 404 else: itinerary_list = itineraryRepository(result_list) itinerary_list = list(map(getInfo, itinerary_list)) return jsonify(Itineraries=itinerary_list)
def getItinerariesByDriverId(self, driver_id): result_list = self.dao.getItinerariesByDriverId(driver_id) itinerary_list = [] if not result_list: return jsonify(Error="Itineraries Not Found"), 404 else: itinerary_list = itineraryRepository(result_list) itinerary_list = list(map(getInfo, itinerary_list)) return jsonify(Itineraries=itinerary_list)
def getAllItineraries(self): result_list = self.dao.getAllItineraries() itinerary_list = [] ''' for row in result_list: itinerary = Itinerary(row) result = itinerary.itineraryInfo() itinerary_list.append(result) ''' itinerary_list = itineraryRepository(result_list) itinerary_list = list(map(getInfo, itinerary_list)) return jsonify(Itineraries=itinerary_list)