Skip to content
Snippets Groups Projects
Commit f3b45891 authored by Herman Andersen Dyrkorn's avatar Herman Andersen Dyrkorn
Browse files

Merge branch '19-refactor-location-endpoint' into 'master'

Resolve "refactor location endpoint"

Closes #19

See merge request !22
parents e70b6925 b97a5f09
No related branches found
No related tags found
1 merge request!22Resolve "refactor location endpoint"
......@@ -18,13 +18,13 @@ api = Api(app)
from api.endpoints.login import Login
from api.endpoints.user import UserEndpoint
from api.endpoints.location import LocationEndpoint
from api.endpoints.matchsalamander import MatchSalamander
from api.endpoints.registerlocation import RegisterLocation
from api.endpoints.findsalamanderinfo import FindSalamanderInfo
api.add_resource(Login, "/login")
api.add_resource(UserEndpoint, "/user")
api.add_resource(LocationEndpoint, "/location")
api.add_resource(MatchSalamander, "/matchSalamander")
api.add_resource(RegisterLocation, "/registerLocation")
api.add_resource(FindSalamanderInfo, "/findSalamanderInfo")
No preview for this file type
......@@ -10,7 +10,7 @@ COORDINATES_REGEX = "^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[
# findSalamanderInfo endpoint
class RegisterLocation(Resource):
class LocationEndpoint(Resource):
@staticmethod
@jwt_required
def post():
......@@ -29,6 +29,16 @@ class RegisterLocation(Resource):
else:
return jsonify({"message": "wrong data"})
@staticmethod
@jwt_required
def get():
locations = db.session.query(Location).all()
location_list = []
for location in locations:
loc = {"id": location.id, "radius": location.radius, "name": location.name, "coordinates": location.coordinates}
location_list.append(loc)
return jsonify(location_list)
def create_directory_folders(location):
dir_smooth_male = "images/" + location + "/smooth_newt/" + "male/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment