Skip to content

Conversation

@baekjaehyuk
Copy link
Collaborator

📌 작업 개요

  • DB에 등록된 영수증 삭제와 S3 버킷에 등록된 객체를 삭제하는 기능 구현

✅ 작업 내용

  1. 삭제할 영수증 ID를 찾아 영수증 삭제
  2. 관리자가 등록하지 않은 영수증에 대해 삭제할 경우, 예외 처리 로직 추가
  3. 삭제된 영수증의 이미지가 S3에 객체로 등록된 경우, S3 객체 삭제
  4. 스웨거 문서 @loginuser 파라미터 숨김 처리
  5. Port 역할을 가지고 있는 클래스에 대한 명확한 클래스 네이밍 지정

📂 리뷰 요구사항

  • Receipt가 삭제되었을 때, ReceiptItem도 삭제가 되도록 orphanRemoval = true로 정의가 되어 있습니다. 여러 개의 영수증 객체를 삭제해야 하기에 deleteAllByIdInBatch로 처리하고자 하였으나 영속성 컨텍스트의 상태와 동기화 문제가 생길 수 있기에 개별적으로 삭제를 처리하는 로직으로 구현했습니다.
  • 추후에 영수증 삭제에 대한 로직에 대해 비동기 처리를 추가할 예정입니다.
  • 현재 회원 이미지 등록과 영수증 이미지 등록에 대한 어댑터의 로직에 대해 중복이 발생하고 있어 이에 대한 논의가 필요할 것 같습니다.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the receipt deletion functionality by adding a service, controller, and API interface while also updating related components for image upload and error handling.

  • Implements deletion of receipts along with associated images from the S3 bucket.
  • Introduces a new DeleteReceiptService and corresponding UseCase, API, and Controller.
  • Updates existing CreateReceiptService and its tests to use the new UploadReceiptImagePort and refines error codes.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CreateReceiptServiceTest.java Updated import to use UploadReceiptImagePort for consistency in receipt image uploads.
ReceiptEditor.java Added a method to generate the list of receipt image URLs to delete, skipping the default image.
DeleteReceiptService.java Introduces logic to delete receipts and their images by integrating with the editor and the deletion ports.
CreateReceiptService.java Updated to use UploadReceiptImagePort for handling receipt image uploads.
DeleteReceiptUseCase.java Added an interface for deleting receipts.
DeleteReceiptApi.java Defines the API for receipt deletion with proper documentation annotations.
DeleteReceiptController.java Implements the deletion endpoint but may lead to redundant endpoint URLs.
LoginUser.java Updated with hidden Swagger parameter annotation.
ErrorCode.java Added a new error code for failure to delete receipts.

@codecov
Copy link

codecov bot commented May 21, 2025

Copy link
Member

@tiemo0708 tiemo0708 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘하신거 같습니다 고생하셨습니다!!

@sonarqubecloud
Copy link

@baekjaehyuk baekjaehyuk merged commit b61f385 into develop May 21, 2025
2 checks passed
@baekjaehyuk baekjaehyuk deleted the TB-33 branch May 21, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants