@@ -48,7 +48,7 @@ def post_photos():
4848 data_to_object = {'uuid' :identifier , 'filepath' : filepath , 'analysed' :False , 'info' :str ("empty" )}
4949 new_photo = Photo .create (** data_to_object )
5050
51- data = {'filename' :f_name , 'id2 ' : new_photo .id }
51+ data = {'filename' :new_photo . filepath , 'uuid ' : new_photo .uuid }
5252 #TODO refactor to set up necessary methods to create responses
5353 #TODO is it necessary to return 200 command
5454 resp = None
@@ -89,21 +89,22 @@ def post_photosStr():
8989 data_to_object = {'uuid' :identifier , 'filepath' : filepath , 'analysed' :False , 'info' :str ("empty" )}
9090 new_photo = Photo .create (** data_to_object )
9191
92- data = {'filename' : f_name , 'id2' : new_photo .id }
92+ data = {'uuid' : new_photo .uuid }
9393 #TODO refactor to set up necessary methods to create responses
9494 #TODO is it necessary to return 200 command
9595 resp = None
9696 if data == None :
9797 resp = responses .new200 ()
9898 else :
99- resp = responses .new201 (data )
99+ resp = responses .new201 (data )
100100 return resp
101101
102102
103- @mod_photos .route ('/photos/<int:id>' ,methods = ['GET' ])
104- def get_photos_one (id ):
105- photo = Photo .query .get_or_404 (id )
106- return jsonify (photo .serialize_all ())
103+ @mod_photos .route ('/photos/<string:uuid>' ,methods = ['GET' ])
104+ def get_photos_one (uuid ):
105+ #photo =Photo.query.get_or_404(id)
106+ photo = Photo .query .filter_by (uuid = uuid ).first_or_404 ()
107+ return jsonify (photo .serialize_all ())
107108
108109@mod_photos .route ('/photos' ,methods = ['GET' ])
109110def get_photos ():
0 commit comments