server/snapshots: add snapshot lists

This commit is contained in:
rr-
2016-04-21 19:25:38 +02:00
parent c2a39a0fd5
commit 46ee9faf72
13 changed files with 227 additions and 77 deletions

View File

@ -0,0 +1,17 @@
from szurubooru import search
from szurubooru.api.base_api import BaseApi
from szurubooru.func import auth, snapshots
def _serialize_snapshot(snapshot):
earlier_snapshot = snapshots.get_previous_snapshot(snapshot)
return snapshots.serialize_snapshot(snapshot, earlier_snapshot)
class SnapshotListApi(BaseApi):
def __init__(self):
super().__init__()
self._search_executor = search.SearchExecutor(search.SnapshotSearchConfig())
def get(self, ctx):
auth.verify_privilege(ctx.user, 'snapshots:list')
return self._search_executor.execute_and_serialize(
ctx, _serialize_snapshot, 'snapshots')