UX-3 附件上传删除功能

This commit is contained in:
Cheng Zhou
2025-12-17 16:16:47 +08:00
parent 9ca30d12f8
commit 1e6cae6b6e
39 changed files with 514 additions and 15 deletions
+8
View File
@@ -57,3 +57,11 @@ async def list_attachments(
async def get_attachment(db: AsyncSession, attachment_id: uuid.UUID) -> Attachment | None:
result = await db.execute(select(Attachment).where(Attachment.id == attachment_id, Attachment.is_deleted.is_(False)))
return result.scalar_one_or_none()
async def soft_delete_attachment(db: AsyncSession, attachment: Attachment) -> Attachment:
attachment.is_deleted = True
db.add(attachment)
await db.commit()
await db.refresh(attachment)
return attachment