Add endpoint for refreshing Album directories.

This commit is contained in:
voussoir 2019-06-15 02:44:46 -07:00
parent 36a2ed9f88
commit 9ab0a61cb3
2 changed files with 16 additions and 0 deletions

View file

@ -78,6 +78,15 @@ def post_album_remove_child(album_id):
response = etiquette.jsonify.album(child) response = etiquette.jsonify.album(child)
return jsonify.make_json_response(response) return jsonify.make_json_response(response)
@site.route('/album/<album_id>/refresh_directories', methods=['POST'])
@decorators.catch_etiquette_exception
def post_album_refresh_directories(album_id):
album = common.P_album(album_id)
for directory in album.get_associated_directories():
common.P.digest_directory(directory, commit=False, new_photo_ratelimit=0.1)
common.P.commit(message='refresh album directories endpoint')
return jsonify.make_json_response({})
# Album photo operations ########################################################################### # Album photo operations ###########################################################################
@site.route('/album/<album_id>/add_photo', methods=['POST']) @site.route('/album/<album_id>/add_photo', methods=['POST'])

View file

@ -71,6 +71,13 @@ function edit(album_id, title, description, callback)
common.post(url, data, callback); common.post(url, data, callback);
} }
api.albums.refresh_directories =
function refresh_directories(album_id, callback)
{
var url = `/album/${album_id}/refresh_directories`;
common.post(url, null, callback);
}
api.albums.remove_child = api.albums.remove_child =
function remove_child(album_id, child_id, callback) function remove_child(album_id, child_id, callback)
{ {