Beispiel #1
0
def getAllFuels():
    if request.method == 'POST':
        return FuelHandler().insertFuel(request.json)
    else:
        if not request.args:
            return FuelHandler().getAllFuels()
        else:
            return FuelHandler().searchFuels(request.args)
Beispiel #2
0
def getAllFuels():
    if request.method == 'POST':
        print("REQUEST: ", request.json)
        return FuelHandler().insertFuelJson(request.json)

    else:
        if not request.args:
            return FuelHandler().getAllFuels()
Beispiel #3
0
def getFuelById(fuid):
    if request.method == 'GET':
        return FuelHandler().getFuelByID(fuid)
    elif request.method == 'PUT':
        return FuelHandler().updateFuel(fuid, request.form)
    elif request.method == 'DELETE':
        return FuelHandler().deleteFuel(fuid)
    else:
        return jsonify(Error="Method not allowed."), 405
Beispiel #4
0
def getAllFuel():
    if request.method == 'POST':
        print("REQUEST: ", request.json)
        return FuelHandler().insertFuelJson(request.json)
    else:
        if not request.args:
            return FuelHandler().getAllFuel()
        else:
            # change to searchFuel() once implemented in handlers
            return FuelHandler().searchFuel(request.args)
 def getResourceFullInfo(self, resource_id):
     resource_dao = ResourceDAO()
     category = resource_dao.getResourceById(resource_id)[2]
     if category == 1:
         return FuelHandler().getFuelByResourceId(resource_id)
     elif category == 2:
         return FoodHandler().getFoodByResourceId(resource_id)
     elif category == 3:
         return MedicineHandler().getMedicineByResourceId(resource_id)
     elif category == 4:
         return ToolHandler().getToolByResourceId(resource_id)
     elif category == 5:
         return ClothHandler().getClothByResourceId(resource_id)
     elif category == 6:
         return HeavyEquipHandler().getHeavyEquipByResourceId(resource_id)
     elif category == 7:
         return WaterHandler().getWaterByResourceId(resource_id)
     elif category == 8:
         return MedDeviceHandler().getMedDeviceByResourceId(resource_id)
     elif category == 9:
         return BatteryHandler().getBatteryByResourceId(resource_id)
     elif category == 10:
         return GeneratorHandler().getGeneratorByResourceId(resource_id)
     elif category == 11:
         return IceHandler().getIceByResourceId(resource_id)
     else:
         return jsonify(Error="Invalid category"), 400
Beispiel #6
0
    def getAllByType(self, type):
        print(type)
        if (type == 'babyfood'):
            return babyFoodHandler().getAllbabyFood()
        elif (type == 'dryfood'):
            return dryFoodHandler().getAlldryFood()
        elif (type == 'cannedfood'):
            return cannedFoodHandler().getAllcannedFood()
        elif (type == 'medication'):
            return MedicationHandler().getAllMedication()
        elif (type == 'batteries'):
            return BatteryHandler().getAllbattery()
        elif (type == 'clothing'):
            return ClothingHandler().getAllClothes()
        elif (type == 'heavyequipment'):
            return HeavyEquipmentHandler().getAllHeavyEquipment()
        elif (type == 'ice'):
            return IceHandler().getAllIce()
        elif (type == 'tools'):
            return PowerToolsHandler().getAllTools()
        elif (type == 'fuel'):
            return FuelHandler().getAllFuel()
        elif (type == 'medicaldevices'):
            return MedicalDevicesHandler().getAllMedicalDevices()
        elif (type == 'powergenerator'):
            return PowerGeneratorHandler().getAllPowerGenerator()
        elif (type == 'hygiene'):
            return HygieneHandler().getAllHygiene()
        elif (type == 'water'):
            return WaterHandler().getAllWater()

        else:
            return MedicationHandler().getAllMedication()
Beispiel #7
0
    def getHandler(self, type):
        if (type == 'babyfood'):
            return babyFoodHandler()
        elif (type == 'dryfood'):
            return dryFoodHandler()
        elif (type == 'cannedfood'):
            return cannedFoodHandler()
        elif (type == 'medication'):
            return MedicationHandler()
        elif (type == 'batteries'):
            return BatteryHandler()
        elif (type == 'clothing'):
            return ClothingHandler()
        elif (type == 'heavyequipment'):
            return HeavyEquipmentHandler()
        elif (type == 'ice'):
            return IceHandler()
        elif (type == 'powertools'):
            return PowerToolsHandler()
        elif (type == 'fuel'):
            return FuelHandler()
        elif (type == 'medicaldevices'):
            return MedicalDevicesHandler()
        elif (type == 'powergenerator'):
            return PowerGeneratorHandler()
        elif (type == 'hygiene'):
            return HygieneHandler()
        elif (type == 'water'):
            return WaterHandler()

        else:
            return MedicationHandler()
Beispiel #8
0
def getAllResourceDetails(resourceid):
    categoryname = CategoriesHandler().getCategoryByResourceID(resourceid)
    if categoryname == "BabyFood":
        return BabyFoodHandler().getBabyFoodByResourceID(resourceid)
    elif categoryname == "Batteries":
        return BatteriesHandler().getBatteriesByResourceID(resourceid)
    elif categoryname == "CannedFood":
        return CannedFoodHandler().getCFoodByResourceID(resourceid)
    elif categoryname == "Clothing":
        return ClothingHandler().getClothingByResourceID(resourceid)
    elif categoryname == "DryFood":
        return DryFoodHandler().getDryFoodByResourceID(resourceid)
    elif categoryname == "Fuel":
        return FuelHandler().getFuelByResourceID(resourceid)
    elif categoryname == "Generators":
        return GeneratorsHandler().getGeneratorsByResourceID(resourceid)
    elif categoryname == "HeavyEquipment":
        return HeavyEquipmentHandler().getHeavyEquipmentByResourceID(
            resourceid)
    elif categoryname == "Ice":
        return IceHandler().getIceByResourceID(resourceid)
    elif categoryname == "MedicalEquipment":
        return MedicalEquipmentHandler().getMedicalEquipmentByResourceID(
            resourceid)
    elif categoryname == "Medication":
        return MedicineHandler().getMedicineByResourceID(resourceid)
    elif categoryname == "Parts":
        return PartsHandler().getPartsByResourceID(resourceid)
    elif categoryname == "Tools":
        return ToolsHandler().getToolsByResourceID(resourceid)
    elif categoryname == "Water":
        return WaterHandler().getWaterByResourceID(resourceid)
Beispiel #9
0
def getResourcesByTypeId(resource_type, resource_type_id):
    if request.method == 'GET':
        if resource_type == 'fuel':
            return FuelHandler().getFuelById(resource_type_id)
        if resource_type == 'ice':
            return IceHandler().getIceById(resource_type_id)
        if resource_type == 'clothing':
            return ClothingHandler().getClothesgById(resource_type_id)
        if resource_type == 'battery':
            return BatteryHandler().getBatteryById(resource_type_id)
        if resource_type == 'babyfood':
            return babyFoodHandler().getbabyFoodById(resource_type_id)
        if resource_type == 'cannedfood':
            return cannedFoodHandler().getcannedFoodById(resource_type_id)
        if resource_type == 'dryfood':
            return dryFoodHandler().getdryFoodById(resource_type_id)
        if resource_type == 'heavyequipment':
            return HeavyEquipmentHandler().getHeavyEquimentById(resource_type_id)
        if resource_type == 'medication':
            return MedicationHandler().getMedicationById(resource_type_id)
        if resource_type == 'tools':
            return PowerToolsHandler().getToolById(resource_type_id)
        if resource_type == 'water':
            return WaterHandler().getWaterById(resource_type_id)
        if resource_type == 'medicaldevices':
            return MedicalDevicesHandler().getMedicalDevicesById(resource_type_id)
        if resource_type == 'powergenerator':
            return PowerGeneratorHandler().getPowerGeneratorById(resource_type_id)
        if resource_type == 'hygiene':
            return HygieneHandler().getHygieneById(resource_type_id)

        else:
            return ResourceHandler().getAllByType(resource_type)
Beispiel #10
0
def getAllReservedFuelsBySupplierId(supplier_id):
    return FuelHandler().getAllReservedFuelsBySupplierId(supplier_id)
Beispiel #11
0
def getAllReservedFuels():
    return FuelHandler().getAllReservedFuels()
Beispiel #12
0
def getAllAvailableFuelsBySupplierId(supplier_id):
    return FuelHandler().getAllAvailableFuelsBySupplierId(supplier_id)
Beispiel #13
0
def getAllAvailableFuels():
    return FuelHandler().getAllAvailableFuels()
Beispiel #14
0
def getFuelsBySupplierId(supplier_id):
    return FuelHandler().getFuelsBySupplierId(supplier_id)
Beispiel #15
0
def getFuelAddress(fuel_id):
    return FuelHandler().getFuelAddress(fuel_id)