Add cover URL edit button and modal
Rows without a cover (cover_url NULL or N/A) show a + button.
Clicking it opens a modal to enter a URL which is saved via new
PATCH /api/records/{id}/cover_url endpoint. cover_image is cleared
so n8n picks it up on the next backfill run.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
50548d44c4
commit
7a7a997f15
+22
@@ -544,6 +544,28 @@ async def get_records(
|
||||
}
|
||||
|
||||
|
||||
class SetCoverUrlBody(BaseModel):
|
||||
cover_url: str
|
||||
|
||||
|
||||
@app.patch("/api/records/{record_id}/cover_url")
|
||||
async def set_record_cover_url(record_id: int, body: SetCoverUrlBody):
|
||||
if pool is None:
|
||||
raise HTTPException(503, detail="Datenbank nicht verbunden")
|
||||
url = body.cover_url.strip()
|
||||
if not url:
|
||||
raise HTTPException(422, detail="cover_url darf nicht leer sein")
|
||||
async with pool.acquire() as conn:
|
||||
row = await conn.fetchrow(
|
||||
f"UPDATE {qualified_table} SET cover_url = $1, cover_image = NULL, cover_mime_type = NULL WHERE id = $2 RETURNING id, cover_url",
|
||||
url,
|
||||
record_id,
|
||||
)
|
||||
if row is None:
|
||||
raise HTTPException(404, detail=f"Eintrag mit ID {record_id} nicht gefunden")
|
||||
return {"id": row["id"], "cover_url": row["cover_url"]}
|
||||
|
||||
|
||||
@app.patch("/api/records/{record_id}/seen")
|
||||
async def set_record_seen(record_id: int, body: SetSeenBody):
|
||||
"""Einzelnen Eintrag als gesehen (seen=true) oder ungesehen (seen=false) markieren."""
|
||||
|
||||
Reference in New Issue
Block a user