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:
parent
f4fd850a49
commit
d2d01aaea7
1 changed files with 2 additions and 3 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue