HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
👊
[승찬민] Around The Town (동네한바퀴)
/
💬
API Spec
/
숙박업소 제거 (soft delete)

숙박업소 제거 (soft delete)

URI
/api/v1/hosts/{hostId}/accommodations/{accommodationId}
담당자
Method
DELETE
진행상태
COMPLETE

SoftDelete를 위해 접근한 방법

@Where(clause = "is_deleted = false") @SQLDelete(sql = "UPDATE product SET is_deleted = true WHERE product_id=?") @DynamicInsert
  • where 절로 is_deleted 필드가 false인 값들만 조회하도록 한다.
  • SQLDelete로 delete query 대신 update 쿼리를 수행한다.
  • DynaicInsert: is_deleted필드에 null이 들어가는것을 방지하고, false로 초기화

Request

HTTP Method = DELETE Request URI = /api/v1/hosts/1/accommodations/2 Parameters = {} Headers = [Content-Type:"application/json;charset=UTF-8"] Body = null Session Attrs = {}

Response

{ "accommodationName":"update 숙박업체 이름" }
잘 삭제되면 status Code 200으로 내려줌
삭제가 안된 경우 404, 500 으로 찾을수없거나 내부 에러로 내려줌.