This repository was archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
[#29] 카페 오픈, 마감 기능 구현 #42
Open
nicky-day
wants to merge
6
commits into
f-lab-edu:develop
Choose a base branch
from
nicky-day:feature/29
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f1b2632
Merge branch 'feature/14' into feature/15
nicky-day 81e7e1d
사장님이 가진 카페 삭제하기 기능 구현
nicky-day 5030587
카페 오픈, 마감 기능 구현하기
nicky-day f39b4f9
Merge branch 'feature/14' into feature/15
nicky-day b1809cc
Merge branch 'feature/15' into feature/29
nicky-day 3bf8554
[#29] feature : 카페 오픈, 마감 기능 구현
nicky-day File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,7 @@ public ResponseEntity getMyCafe(@PathVariable Long cafeId, | |
| } | ||
|
|
||
| @PatchMapping("/{cafeId}") | ||
| public ResponseEntity updateCafe(@PathVariable long cafeId, | ||
| public ResponseEntity updateCafe(@PathVariable Long cafeId, | ||
| @RequestBody @Validated CafeDTO cafeDTO, BindingResult bindingResult, | ||
| HttpSession httpSession) { | ||
| Long userId = (Long) httpSession.getAttribute(SessionKeys.USER_ID); | ||
|
|
@@ -94,4 +94,28 @@ public ResponseEntity updateCafe(@PathVariable long cafeId, | |
| cafeService.updateCafe(cafeDTO); | ||
| return ResponseEntity.ok(cafeDTO); | ||
| } | ||
|
|
||
| @PatchMapping("/{cafeId}/open") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. restful 한 uri 를 설계한다고 했을때 open 이나 close 와 같은 동사를 uri 상에 표현하는것은 좋지 않습니다. |
||
| public ResponseEntity openCafe (@PathVariable Long cafeId, HttpSession httpSession){ | ||
| Long userId = (Long) httpSession.getAttribute(SessionKeys.USER_ID); | ||
| boolean openCafe = cafeService.openCafe(cafeId); | ||
| if (!openCafe) { | ||
| LOGGER.info("카페를 오픈할 수 없습니다. userId = {}, cafeId = {}", userId, cafeId); | ||
| return ResponseEntity.badRequest().build(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앞의 PR의 comment 참고 |
||
| } else { | ||
| return ResponseEntity.ok().build(); | ||
| } | ||
| } | ||
|
|
||
| @PatchMapping("/{cafeId}/close") | ||
| public ResponseEntity closeCafe (@PathVariable Long cafeId, HttpSession httpSession){ | ||
| Long userId = (Long) httpSession.getAttribute(SessionKeys.USER_ID); | ||
| boolean closeCafe = cafeService.closeCafe(cafeId); | ||
| if (!closeCafe) { | ||
| LOGGER.info("카페를 마감할 수 없습니다. userId = {}, cafeId = {}", userId, cafeId); | ||
| return ResponseEntity.badRequest().build(); | ||
| } else { | ||
| return ResponseEntity.ok().build(); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,28 +39,27 @@ | |
| #{withPet}, | ||
| #{cafeCondition}, | ||
| #{cafeRegistration}) | ||
| <selectKey resultType="long" keyProperty="cafeId" order="AFTER"> | ||
| SELECT LAST_INSERT_ID() | ||
| </selectKey> | ||
| </insert> | ||
|
|
||
| <select id="selectMyAllCafe" parameterType="long" | ||
| resultType="com.flab.cafeguidebook.dto.CafeDTO"> | ||
| SELECT * | ||
| FROM CAFE | ||
| WHERE user_id = #{userId} | ||
| </select> | ||
|
|
||
| <select id="selectMyCafe" resultType="com.flab.cafeguidebook.dto.CafeDTO" | ||
| parameterType="map"> | ||
| SELECT * | ||
| FROM CAFE | ||
| WHERE cafe_id = #{cafeId} | ||
| AND user_id = #{userId} | ||
| </select> | ||
|
|
||
| <delete id="deleteAllCafe"> | ||
| DELETE | ||
| FROM CAFE; | ||
| </delete> | ||
|
|
||
| <update id="updateCafe" parameterType="com.flab.cafeguidebook.dto.CafeDTO"> | ||
| UPDATE CAFE | ||
| SET | ||
|
|
@@ -79,11 +78,19 @@ | |
| update_date = now() | ||
| WHERE cafe_id = #{cafeId} | ||
| </update> | ||
|
|
||
| <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> | ||
|
Comment on lines
+81
to
+90
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 두개의 쿼리가 동일한것으로 보이는데 sql 은 하나로 하고 사용시 condition을 주는 방식으로 구현할수 있을것 같습니다. |
||
| <update id="updateRegistration"> | ||
| UPDATE CAFE SET cafe_registration = #{cafeRegistration} | ||
| WHERE cafe_id = #{cafeId} | ||
| </update> | ||
|
|
||
| UPDATE CAFE SET cafe_registration = #{cafeRegistration} | ||
| WHERE cafe_id = #{cafeId} | ||
| </update> | ||
| </mapper> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapper type 으로 변경한 이유가 있을까요?