Exemplo n.º 1
0
def getSearchresources():
    """ Get the items requested in a given category subcategory"""
    handler = ResourcesHandler()
    if not request.args:
        return ResourcesHandler().getAllresources()
    else:
        return handler.getFindAllresources(request.args)
Exemplo n.º 2
0
def getAllResources():
    if request.method == 'POST':
        print("REQUEST: ", request.json)
        return ResourcesHandler().insertResourceJson(request.json)
    else:
        if not request.args:
            return ResourcesHandler().getAllResources()
Exemplo n.º 3
0
def getResourceById(rid):
    if request.method == 'GET':
        return ResourcesHandler().getResourceById(rid)
    elif request.method == 'PUT':
        return ResourcesHandler().updateResource(rid, request.get_json())
    else:
        return jsonify(Error="Method Not Allowed"), 405
Exemplo n.º 4
0
def getAllResources():
    if request.method == 'POST':
        return ResourcesHandler().insertResources(request.form)
    else:
        if not request.args:
            return ResourcesHandler().getAllResources()
        else:
            return ResourcesHandler().searchResources(request.args)
Exemplo n.º 5
0
def getAllBatteryResources():
    if request.method == 'POST':
        return jsonify(Message="Battery Resource created."), 200
    else:
        if not request.args:
            return ResourcesHandler().getAllBatteryResources()
        else:
            return ResourcesHandler().searchBatteryResources(request.args)
Exemplo n.º 6
0
def getAllMedicalDeviceResources():
    if request.method == 'POST':
        return jsonify(Message="Medical Device Resource created."), 200
    else:
        if not request.args:
            return ResourcesHandler().getAllMedicalDeviceResources()
        else:
            return ResourcesHandler().searchMedicalDeviceResources(
                request.args)
Exemplo n.º 7
0
def getResourceById(resource_id):
    if request.method == 'GET':
        return ResourcesHandler().getResourceById(resource_id)
    elif request.method == 'PUT':
        return ResourcesHandler().updateResource(resource_id, request.json)
    elif request.method == 'DELETE':
        return ResourcesHandler().deleteResource(resource_id)
    else:
        return jsonify(Error="Method not allowed."), 405
Exemplo n.º 8
0
def getAllPowerGeneratorResources():
    if request.method == 'POST':
        return jsonify(Message="Power Generators Resource created."), 200
    else:
        if not request.args:
            return ResourcesHandler().getAllPowerGeneratorResources()
        else:
            return ResourcesHandler().searchPowerGeneratorResources(
                request.args)
Exemplo n.º 9
0
def getAllHeavyEquipmentResources():
    if request.method == 'POST':
        return jsonify(Message="Heavy Equipment Resource created."), 200
    else:
        if not request.args:
            return ResourcesHandler().getAllHeavyEquipmentResources()
        else:
            return ResourcesHandler().searchHeavyEquipmentResources(
                request.args)
Exemplo n.º 10
0
def getAllResources():
    if request.method == 'POST':
        return ResourcesHandler().insertResource(request.get_json())
    elif request.method == 'GET':
        if not request.args:
            return ResourcesHandler().getAllResources()
        else:
            return ResourcesHandler().searchResources(request.args)
    else:
        return jsonify(Error="Method Not Allowed"), 405
Exemplo n.º 11
0
def getAllResourcesRequested():
    ## """ See all the Resources Requested."""
    if request.method == 'GET':
        return ResourcesHandler().getAllresources_requested()
    elif request.method == 'PUT':
        return ResourcesHandler().updateResourcesRequested(
            request.form, request.get_json())
    elif request.method == 'POST':
        return ResourcesHandler().insertResourcesRequested(
            request.form, request.get_json())
    else:
        return jsonify(Error="Method not allowed"), 405
Exemplo n.º 12
0
def getResourcesAvailable():
    if request.method == 'GET':
        ## """ Show  Resources available."""
        return ResourcesHandler().getAllresources_avaliable()
    elif request.method == 'PUT':
        return ResourcesHandler().updateResourcesAvailable(
            request.form, request.get_json())
    elif request.method == 'POST':
        return ResourcesHandler().insertResourcesAvailable(
            request.form, request.get_json())
    else:
        return jsonify(Error="Method not allowed"), 405
Exemplo n.º 13
0
def getFuelResourceById(resource_id):
    if request.method == 'GET':
        return ResourcesHandler().getFuelResourceById(resource_id)
    elif request.method == 'PUT':
        # ResourcesHandler().updateFuelResource(resource_id,request.form)
        return jsonify(Message="Fuel Resource update successful"), 200
    elif request.method == 'DELETE':
        # ResourcesHandler().deleteFuelResource(resource_id)
        return jsonify(Message="Fuel Resource delete successful"), 200
Exemplo n.º 14
0
def getWaterResourceById(resource_id):
    if request.method == 'GET':
        return ResourcesHandler().getWaterResourceById(resource_id)
    elif request.method == 'PUT':
        #ResourcesHandler().updateWaterResource(resource_id,request.form)
        return jsonify(Message="Water Resource update successful"), 200
    elif request.method == 'DELETE':
        #ResourcesHandler().deleteWaterResource(resource_id)
        return jsonify(Message="Water Resource delete successful"), 200
    else:
        return jsonify(Error="Method not allowed."), 405
Exemplo n.º 15
0
def getAllresources():
    """ Get the items requested in a given category subcategory"""
    handler = ResourcesHandler()
    return handler.getAllresources()
Exemplo n.º 16
0
def getSearchResourcesAvailable():
    """ Search in  the Resources Avaliable. Follow by ?name=description"""
    if not request.args:
        return ResourcesHandler().getAllresources_avaliable()
    else:
        return ResourcesHandler().getresources_avaliable(request.args)
Exemplo n.º 17
0
def getRequestedResources():
    if request.method == 'POST':
        return ResourcesHandler().insertRequest(request.form)
    else:
        return ResourcesHandler().getRequestedResources()
Exemplo n.º 18
0
def getResourceSupplierByResourceID(id):
    """Get Resources that a given requester id supplies"""
    return ResourcesHandler().getResourcesRequestedOfRequesterByID(rid)
Exemplo n.º 19
0
def resourcesByID(id):
    return ResourcesHandler().getByID(id)
Exemplo n.º 20
0
def getResourceCount():
    """ Returns the ammount of resources"""
    if request.method == 'GET':
        return ResourcesHandler().count()
    else:
        return jsonify(Error="Method not allowed. "), 405
Exemplo n.º 21
0
def getResourcesAvailable():
    if not request.args:
        return ResourcesHandler().getResourcesAvailable()
    else:
        return ResourcesHandler().searchResourcesAvailable(request.args)
Exemplo n.º 22
0
def getSuppliersByResourceId(resourceID):
    return ResourcesHandler().getSuppliersByResourceId(resourceID)
Exemplo n.º 23
0
def getResourcesRequestedByApplicantsId(apl_ID):
    return ResourcesHandler().getResourcesRequestedByApplicantID(apl_ID)
Exemplo n.º 24
0
def getResourceAvailableByID(rid):
    """ Get Resources Requested by id"""
    return ResourcesHandler().getResourceRequestedByID(rid)
Exemplo n.º 25
0
def getSearchResourcesRequested():
    """ See all the Resources Requested. Follow by ?name=description"""
    if not request.args:
        return ResourcesHandler().getAllresources_requested()
    else:
        return ResourcesHandler().getresources_requested(request.args)
Exemplo n.º 26
0
def getResourcesAvailableByID(rid):
    """Get Resource By ID"""
    return ResourcesHandler().getResourceAvaliableByRID(rid)
Exemplo n.º 27
0
def getResouresAvaliableBySupplierID(rid):
    """Get Suppliers who supply a Resource"""
    return ResourcesHandler().getSuppliersForAvailableResourceByRID(rid)
Exemplo n.º 28
0
def getResourceSuppliedbySupplierID(id):
    """Get Resources that a given supplier id supplies"""
    return ResourcesHandler().getResourcesAvalibleOfSupplierByID(id)
Exemplo n.º 29
0
def resources():
    if request.method == POST:
        return ResourcesHandler().add(request.json)
    else:
        return ResourcesHandler().getAll()
Exemplo n.º 30
0
def getResourcesInNeed():
    if not request.args:
        return ResourcesHandler().getResourcesInNeed()
    else:
        return ResourcesHandler().searchResourcesInNeed(request.args)