feat(provenance): ProvenanceService.for_post (post-header payload)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 18:06:36 -04:00
parent 491bdcb943
commit 0de8eaa4c6
2 changed files with 41 additions and 0 deletions
@@ -65,3 +65,20 @@ class ProvenanceService:
for ip, post, src, art in rows
],
}
async def for_post(self, post_id: int) -> dict | None:
stmt = (
select(Post, Source, Artist)
.join(Source, Source.id == Post.source_id)
.join(Artist, Artist.id == Source.artist_id)
.where(Post.id == post_id)
)
row = (await self.session.execute(stmt)).first()
if row is None:
return None
post, src, art = row
return {
"post": _post_dict(post),
"source": _source_dict(src),
"artist": _artist_dict(art),
}