[4기 고범준] Springboot-jpa weekly 미션 1차 PR입니다. #322
Open
K-jun98 wants to merge 16 commits intoprgrms-be-devcourse:K-jun98from
Open
[4기 고범준] Springboot-jpa weekly 미션 1차 PR입니다. #322K-jun98 wants to merge 16 commits intoprgrms-be-devcourse:K-jun98from
K-jun98 wants to merge 16 commits intoprgrms-be-devcourse:K-jun98from
Conversation
seung-hun-h
suggested changes
Aug 2, 2023
Comment on lines
+6
to
+9
| @Configuration | ||
| @EnableJpaAuditing | ||
| public class JpaConfig { | ||
| } |
| import static org.springframework.http.HttpStatus.OK; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api") |
Comment on lines
+33
to
+38
| @PatchMapping("/customers/{id}") | ||
| @ResponseStatus(OK) | ||
| public ResponseEntity<Void> updateCustomer(@PathVariable Long id, @RequestBody CustomerUpdateRequest request) { | ||
| customerService.update(id, request); | ||
| return ResponseEntity.noContent().build(); | ||
| } |
There was a problem hiding this comment.
이렇게되면 상태코드가 200, 204 중에 어느 것이 응답되나요?
명확하게 정해주는 것이 좋을 것 같아요
그리고 ResponseEntity 모두 사용거나 그렇지 않거나 통일하면 좋을 것 같아요
|
|
||
| @PatchMapping("/customers/{id}") | ||
| @ResponseStatus(OK) | ||
| public ResponseEntity<Void> updateCustomer(@PathVariable Long id, @RequestBody CustomerUpdateRequest request) { |
Comment on lines
+35
to
+38
| public void update(String firstName, String lastName) { | ||
| this.firstName = firstName; | ||
| this.lastName = lastName; | ||
| } |
Member
Author
There was a problem hiding this comment.
Request DTO에서 @blank 를 통해 공백역시 통과되지 않게 하고있습니다. 도메인에서의 검증도 레이어가 다르기 때문에 하는게 좋다고는 생각되나 프로젝트가 작아서 생략했습니다,,
src/main/resources/application.yml
Outdated
| properties: | ||
| hibernate: | ||
| format_sql: true | ||
| jdbc: |
dojinyou
reviewed
Aug 2, 2023
dojinyou
reviewed
Aug 5, 2023
Comment on lines
+42
to
+47
| @PatchMapping("/{id}") | ||
| public ResponseEntity<Void> updateCustomer(@PathVariable Long id, | ||
| @RequestBody @Valid CustomerUpdateRequest request) { | ||
| customerService.update(id, request); | ||
| return ResponseEntity.noContent().build(); | ||
| } |
Member
There was a problem hiding this comment.
@ResponseStatus(NO_CONTENT)에 void 타입을 리턴하는 것이 다른 메서드들과의 일관성이 있는 것 같은데 어떻게 생각하시나요?
Comment on lines
+35
to
+38
| public void update(String firstName, String lastName) { | ||
| this.firstName = firstName; | ||
| this.lastName = lastName; | ||
| } |
Comment on lines
+49
to
+53
| private Customer getCustomerObject(Long id) { | ||
| Customer customer = customerRepository.findById(id) | ||
| .orElseThrow(CustomerNotFoundException::new); | ||
| return customer; | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📌 과제 설명