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)
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
def getAllReservedHeavyEquipBySupplierId(supplier_id): return HeavyEquipHandler().getAllReservedHeavyEquipBySupplierId( supplier_id)
def getAllReservedHeavyEquip(): return HeavyEquipHandler().getAllReservedHeavyEquip()
def getAllAvailableHeavyEquipBySupplierId(supplier_id): return HeavyEquipHandler().getAllAvailableHeavyEquipBySupplierId( supplier_id)
def getAllAvailableHeavyEquip(): return HeavyEquipHandler().getAllAvailableHeavyEquip()
def getHeavyEquipAddress(hequip_id): return HeavyEquipHandler().getHeavyEquipAddress(hequip_id)
def getHeavyEquipBySupplierId(supplier_id): return HeavyEquipHandler().getHeavyEquipBySupplierId(supplier_id)