Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.

Conversation

@nicky-day
Copy link
Collaborator

@nicky-day nicky-day commented Aug 15, 2021

Fixes #29

개요

  • 카페 주인이 카페 오픈과 마감을 할 수 있도록 기능을 구현합니다.

작업사항

  • 1. 비즈니스 로직 작성
  • 2. 테스트 코드 작성(통합 테스트 검증에 필요한 cafeId가 auto_increment 칼럼이므로 단위 테스트 코드로 대체합니다.)

@nicky-day nicky-day self-assigned this Aug 15, 2021
@nicky-day
Copy link
Collaborator Author

nicky-day commented Sep 5, 2021

카페 등록하기 기능 수정 merge 이후에 다시 git rebase 하겠습니다.

  1. 카페 등록하기 수정 #44 PR Merge
  2. 카페 등록 시 카페 아이디 중복 체크 구현 #70 cafeId를 DB에서 자동 생성되게 수정


@PatchMapping("/{cafeId}")
public ResponseEntity updateCafe(@PathVariable long cafeId,
public ResponseEntity updateCafe(@PathVariable Long cafeId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrapper type 으로 변경한 이유가 있을까요?

return ResponseEntity.ok(cafeDTO);
}

@PatchMapping("/{cafeId}/open")
Copy link
Collaborator

Choose a reason for hiding this comment

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

restful 한 uri 를 설계한다고 했을때 open 이나 close 와 같은 동사를 uri 상에 표현하는것은 좋지 않습니다.
cafe 의 상태에 open, closed 를 만들고 cafe 를 업데이트 하는 형태의 uri 설계가 더 좋습니다.

boolean openCafe = cafeService.openCafe(cafeId);
if (!openCafe) {
LOGGER.info("카페를 오픈할 수 없습니다. userId = {}, cafeId = {}", userId, cafeId);
return ResponseEntity.badRequest().build();
Copy link
Collaborator

Choose a reason for hiding this comment

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

앞의 PR의 comment 참고

Comment on lines +81 to +90
<update id="openCafe">
UPDATE CAFE
SET cafe_condition = #{cafeCondition}
WHERE cafe_id = #{cafeId}
</update>
<update id="closeCafe">
UPDATE CAFE
SET cafe_condition = #{cafeCondition}
WHERE cafe_id = #{cafeId}
</update>
Copy link
Collaborator

Choose a reason for hiding this comment

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

두개의 쿼리가 동일한것으로 보이는데 sql 은 하나로 하고 사용시 condition을 주는 방식으로 구현할수 있을것 같습니다.

@f-lab-michael
Copy link
Collaborator

충돌 해결 및 comment 확인 해주세요~

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

카페 오픈, 마감 기능

2 participants