예제 #1
0
def getAllResources():
    if request.method == 'POST':
        return ResourcesHandler().insertResource(request.form)
    else:
        if not request.args:
            return ResourcesHandler().getAllResources()
        else:
            return ResourcesHandler().searchResource(request.args)
예제 #2
0
def getResourceById(r_id):
    if request.method == 'GET':
        return ResourcesHandler().getResourceById(r_id)
    elif request.method == 'PUT':  #Update
        return ResourcesHandler().updateResource(r_id, request.form)
    elif request.method == 'DELETE':
        return ResourcesHandler().deleteResource(r_id)
    else:
        return jsonify(Error="Method not allowed"), 405
예제 #3
0
def getLocationByResourceId(r_id):
    class Map:
        def __init__(self, name, lat, lng):
            self.name = name
            self.lat = lat
            self.lng = lng

    api_key = "AIzaSyCeHf-jcEx21QPuV7BZOUOukikZ-bQYxDA"
    google = GoogleMaps(api_key)
    location = ResourcesHandler().getLocationByResourceId(r_id)
    geocode_result = google.geocode(location + ', Puerto Rico')
    lat = geocode_result[0]['geometry']['location']['lat']
    lng = geocode_result[0]['geometry']['location']['lng']
    map = Map(location, lat, lng)
    return render_template('map.html', map=map)
예제 #4
0
def getResourcesAvailableBySenateRegion():
    return ResourcesHandler().getResourcesAvailableBySenateRegion()
예제 #5
0
def getAllResourcesReserves():
    return ResourcesHandler().getAllResourcesReserves()
예제 #6
0
def getSupplierByResourceId(r_id):
    return ResourcesHandler().getSuppliersByResourceId(r_id)
예제 #7
0
def getResourcesAvailableWeekly():
    return ResourcesHandler().getResourcesAvailableWeekly()
예제 #8
0
def getResourcesMatchingWeekly():
    return ResourcesHandler().getResourcesMatchingWeekly()
예제 #9
0
def getResourcesInNeedDaily():
    return ResourcesHandler().getResourcesInNeedDaily()
예제 #10
0
def getResourcesInNeedWeekly():
    return ResourcesHandler().getResourcesInNeedWeekly()
예제 #11
0
def getAllResourcesRequests():
    return ResourcesHandler().getAllResourcesRequests()
예제 #12
0
def getResourcesMatchingBySenateRegion():
    return ResourcesHandler().getResourcesMatchingBySenateRegion()
예제 #13
0
def getResourcesInNeedBySenateRegion():
    return ResourcesHandler().getResourcesInNeedBySenateRegion()
예제 #14
0
def sortResourcesAvailableByResourceName():
    return ResourcesHandler().sortResourcesAvailableByResourceName()
예제 #15
0
def getAllResourcesAvailable():
    return ResourcesHandler().getAllResourcesAvailable()
예제 #16
0
def sortResourcesRequestsByResourceName():
    return ResourcesHandler().sortResourcesRequestsByResourceName()
예제 #17
0
def getAllResourcesPurchases():
    return ResourcesHandler().getAllResourcesPurchases()