b255a0f90e
Renames src/fabledassistant -> src/scribe and all imports, plus the default DB name and DB user/password (fabled -> scribe) in config + compose. 952 refs / 154 files. Reverses the old 'internal name stays fabledassistant' convention. Code-only: live databases are still physically named 'fabledassistant'. Deployed environments must set POSTGRES_DB / POSTGRES_USER (or rename the DB) since the defaults now resolve to 'scribe'. Repo (FabledScribe), git host (fabledsword), MCP (fabled-git) and the image name (fabledscribe) are intentionally unchanged. ruff check src/ clean locally; CI (typecheck + pytest) is the gate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
825 B
Python
34 lines
825 B
Python
"""Trash REST API — list / restore / purge soft-deleted content by batch."""
|
|
from __future__ import annotations
|
|
|
|
from quart import Blueprint, g, jsonify
|
|
|
|
from scribe.auth import login_required
|
|
import scribe.services.trash as trash_svc
|
|
|
|
trash_bp = Blueprint("trash", __name__, url_prefix="/api/trash")
|
|
|
|
|
|
def _uid() -> int:
|
|
return g.user.id
|
|
|
|
|
|
@trash_bp.get("")
|
|
@login_required
|
|
async def list_trash():
|
|
return jsonify({"batches": await trash_svc.list_trash(_uid())})
|
|
|
|
|
|
@trash_bp.post("/<batch_id>/restore")
|
|
@login_required
|
|
async def restore_batch(batch_id: str):
|
|
n = await trash_svc.restore(_uid(), batch_id)
|
|
return jsonify({"restored": n})
|
|
|
|
|
|
@trash_bp.delete("/<batch_id>")
|
|
@login_required
|
|
async def purge_batch(batch_id: str):
|
|
n = await trash_svc.purge(_uid(), batch_id)
|
|
return jsonify({"purged": n})
|