From c572f5784e11df0f08d52b2567a755f4b9cd429a Mon Sep 17 00:00:00 2001 From: panya Date: Sun, 28 Dec 2025 22:57:56 +0900 Subject: [PATCH] return updated post --- app/posts/repository.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/posts/repository.py b/app/posts/repository.py index 57a572e..47f731b 100644 --- a/app/posts/repository.py +++ b/app/posts/repository.py @@ -130,9 +130,15 @@ async def update( post.description = description post.category = category post.tags = tags + + # 기존 이미지 삭제 후 먼저 flush (INSERT보다 DELETE가 먼저 실행되도록) post.images.clear() + await self.session.flush() + + # 새 이미지 추가 post.images.extend(images) await self.session.flush() + return post async def count_by_user_handle(self, *, user_handle: str) -> int: