feat(integrity): image-detail payload includes integrity_status
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -245,6 +245,7 @@ class GalleryService:
|
|||||||
"width": record.width,
|
"width": record.width,
|
||||||
"height": record.height,
|
"height": record.height,
|
||||||
"size_bytes": record.size_bytes,
|
"size_bytes": record.size_bytes,
|
||||||
|
"integrity_status": record.integrity_status,
|
||||||
"created_at": record.created_at.isoformat(),
|
"created_at": record.created_at.isoformat(),
|
||||||
"thumbnail_url": thumbnail_url(record.sha256, record.mime),
|
"thumbnail_url": thumbnail_url(record.sha256, record.mime),
|
||||||
"image_url": f"/images/{record.path.split('/images/', 1)[-1]}",
|
"image_url": f"/images/{record.path.split('/images/', 1)[-1]}",
|
||||||
|
|||||||
@@ -122,3 +122,14 @@ async def test_neighbors(db):
|
|||||||
async def test_get_image_with_tags_returns_none_for_missing(db):
|
async def test_get_image_with_tags_returns_none_for_missing(db):
|
||||||
svc = GalleryService(db)
|
svc = GalleryService(db)
|
||||||
assert await svc.get_image_with_tags(99999) is None
|
assert await svc.get_image_with_tags(99999) is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_get_image_with_tags_includes_integrity_status(db):
|
||||||
|
images = await _seed_images(db, 1)
|
||||||
|
img = images[0]
|
||||||
|
img.integrity_status = "ok"
|
||||||
|
await db.flush()
|
||||||
|
svc = GalleryService(db)
|
||||||
|
payload = await svc.get_image_with_tags(img.id)
|
||||||
|
assert payload["integrity_status"] == "ok"
|
||||||
|
|||||||
Reference in New Issue
Block a user