Exemple #1
0
def getAllHeavyEquip():
    if request.method == 'POST':
        return HeavyEquipHandler().insertHeavyEquip(request.json)
    else:
        if not request.args:
            return HeavyEquipHandler().getAllHeavyEquip()
        else:
            return HeavyEquipHandler().searchHeavyEquip(request.args)
Exemple #2
0
def getHeavyEquipById(hequip_id):
    if request.method == 'GET':
        return HeavyEquipHandler().getHeavyEquipById(hequip_id)
    elif request.method == 'PUT':
        return HeavyEquipHandler().updateHeavyEquip(hequip_id, request.json)
    elif request.method == 'DELETE':
        return HeavyEquipHandler().deleteHeavyEquip(hequip_id)
    else:
        return jsonify(Error="Method not allowed."), 405
 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
Exemple #4
0
def getAllReservedHeavyEquipBySupplierId(supplier_id):
    return HeavyEquipHandler().getAllReservedHeavyEquipBySupplierId(
        supplier_id)
Exemple #5
0
def getAllReservedHeavyEquip():
    return HeavyEquipHandler().getAllReservedHeavyEquip()
Exemple #6
0
def getAllAvailableHeavyEquipBySupplierId(supplier_id):
    return HeavyEquipHandler().getAllAvailableHeavyEquipBySupplierId(
        supplier_id)
Exemple #7
0
def getAllAvailableHeavyEquip():
    return HeavyEquipHandler().getAllAvailableHeavyEquip()
Exemple #8
0
def getHeavyEquipAddress(hequip_id):
    return HeavyEquipHandler().getHeavyEquipAddress(hequip_id)
Exemple #9
0
def getHeavyEquipBySupplierId(supplier_id):
    return HeavyEquipHandler().getHeavyEquipBySupplierId(supplier_id)