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:
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user