Open
Conversation
added 14 commits
September 13, 2023 12:42
wonjunYou
reviewed
Sep 17, 2023
| private final MemberService memberService; | ||
|
|
||
| @PostMapping("/new") | ||
| public MemberResponse create(@Valid @RequestBody MemberRequest memberRequest) { |
Member
There was a problem hiding this comment.
ResponseEntity 적용을 한번 고려해보면 좋을 듯
Member
There was a problem hiding this comment.
return ResponseEntity.created()~~~
| import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
|
||
| @RestControllerAdvice | ||
| public class GlobalExceptionHandler { |
Member
There was a problem hiding this comment.
|
|
||
| private final MemberRepository memberRepository; | ||
|
|
||
| public MemberResponse join(MemberRequest memberRequest) { |
Member
There was a problem hiding this comment.
| updatePostWriter(request); | ||
| } | ||
|
|
||
| private void updatePostWriter(UpdateMemberRequest request) { |
| private final PostService postService; | ||
|
|
||
| @PostMapping("/new") | ||
| public PostResponse post(@PathVariable Long memberId, @Valid @RequestBody PostRequest postRequest) { |
Member
There was a problem hiding this comment.
PostRequest : 요청 DTO인데, 엔티티로의 변환이 서비스에서 이루어짐. BUT, 응답을 받아올 때 entity -> 응답 dto로의 변환은 Controller에서 이뤄지고 있음.
| @Transactional(readOnly = true) | ||
| public Post findPost(Long postId) { | ||
| return postRepository.findById(postId) | ||
| .orElseThrow(() -> new IllegalArgumentException("사용자가 존재하지 않습니다.")); |
|
|
||
| public void delete(Long memberId, Long postId) throws Exception { | ||
| Member member = memberService.findOne(memberId); | ||
| List<Post> posts = member.getPosts(); |
Member
There was a problem hiding this comment.
Post post = postRepository.findById(postId);
Comment on lines
+2
to
+6
| datasource: | ||
| driver-class-name: com.mysql.cj.jdbc.Driver | ||
| username: root | ||
| url: jdbc:mysql://localhost:3306/cow_session | ||
| password: Gh852852! |
Member
There was a problem hiding this comment.
yml파일의 컬럼을 git에 그대로 등록하면 pw, key 노출 가능성이 있다. 어떻게 할까?
Member
There was a problem hiding this comment.
암호화라던가 뭐 아니면 저런 yml파일을 관리하는 방식을 공부할 필요가 있을 것 같다.
Comment on lines
+6
to
+13
| @SpringBootTest | ||
| class JpapracticeApplicationTests { | ||
|
|
||
| @Test | ||
| void contextLoads() { | ||
| } | ||
|
|
||
| } |
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor |
added 4 commits
September 18, 2023 00:45
재할당 막기, delete 시에 post에서 해당 사용자인지 확인하도록 변경
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.
postman API