"""Trash REST API — list / restore / purge soft-deleted content by batch.""" from __future__ import annotations from quart import Blueprint, jsonify from scribe.auth import get_current_user_id, login_required import scribe.services.trash as trash_svc trash_bp = Blueprint("trash", __name__, url_prefix="/api/trash") @trash_bp.get("") @login_required async def list_trash(): return jsonify({"batches": await trash_svc.list_trash(get_current_user_id())}) @trash_bp.post("//restore") @login_required async def restore_batch(batch_id: str): n = await trash_svc.restore(get_current_user_id(), batch_id) return jsonify({"restored": n}) @trash_bp.delete("/") @login_required async def purge_batch(batch_id: str): n = await trash_svc.purge(get_current_user_id(), batch_id) return jsonify({"purged": n})