Add /album/set_thumbnail_photo endpoint.
This commit is contained in:
		
							parent
							
								
									e77a2209eb
								
							
						
					
					
						commit
						da8dff6f85
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		|  | @ -89,6 +89,15 @@ def post_album_refresh_directories(album_id): | ||||||
|     common.P.commit(message='refresh album directories endpoint') |     common.P.commit(message='refresh album directories endpoint') | ||||||
|     return jsonify.make_json_response({}) |     return jsonify.make_json_response({}) | ||||||
| 
 | 
 | ||||||
|  | @site.route('/album/<album_id>/set_thumbnail_photo', methods=['POST']) | ||||||
|  | @decorators.required_fields(['photo_id'], forbid_whitespace=True) | ||||||
|  | def post_album_set_thumbnail_photo(album_id): | ||||||
|  |     album = common.P_album(album_id, response_type='json') | ||||||
|  |     photo = common.P_photo(request.form['photo_id'], response_type='json') | ||||||
|  |     album.set_thumbnail_photo(photo) | ||||||
|  |     common.P.commit(message='album set thumbnail photo endpoint') | ||||||
|  |     return jsonify.make_json_response(album.jsonify()) | ||||||
|  | 
 | ||||||
| # Album photo operations ########################################################################### | # Album photo operations ########################################################################### | ||||||
| 
 | 
 | ||||||
| @site.route('/album/<album_id>/add_photo', methods=['POST']) | @site.route('/album/<album_id>/add_photo', methods=['POST']) | ||||||
|  |  | ||||||
|  | @ -100,6 +100,15 @@ function remove_photos(album_id, photo_ids, callback) | ||||||
|     api.albums._add_remove_photos(album_id, photo_ids, "remove", callback); |     api.albums._add_remove_photos(album_id, photo_ids, "remove", callback); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | api.albums.set_thumbnail_photo = | ||||||
|  | function set_thumbnail_photo(album_id, photo_id, callback) | ||||||
|  | { | ||||||
|  |     const url = `/album/${album_id}/set_thumbnail_photo`; | ||||||
|  |     const data = new FormData(); | ||||||
|  |     data.append("photo_id", photo_id); | ||||||
|  |     common.post(url, data, callback); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| api.albums.callback_follow = | api.albums.callback_follow = | ||||||
| function callback_follow(response) | function callback_follow(response) | ||||||
| { | { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue