Fix campaign update by re-fetching after flush

The previous refresh() call only reloaded relationships, not scalar
attributes like updated_at. Re-fetching via get_by_id ensures all
attributes and relationships are properly loaded.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael 2026-01-08 10:27:26 -06:00
parent f4fd850a49
commit d2d01aaea7

View file

@ -90,9 +90,8 @@ class CampaignRepository:
setattr(campaign, key, value)
await self.session.flush()
# Refresh to reload expired attributes and relationships after flush
await self.session.refresh(campaign, ["agency", "proofs"])
return campaign
# Re-fetch to get fresh data with eager-loaded relationships
return await self.get_by_id(campaign_id)
async def delete(self, campaign_id: uuid.UUID) -> bool:
"""Delete a campaign and all related proofs."""