Skip to content

Feature/#26 게시판기능구현#49

Open
imchanyang wants to merge 8 commits intomainfrom
feature/#26-게시판기능구현

Hidden character warning

The head ref may contain hidden characters: "feature/#26-\uac8c\uc2dc\ud310\uae30\ub2a5\uad6c\ud604"
Open

Feature/#26 게시판기능구현#49
imchanyang wants to merge 8 commits intomainfrom
feature/#26-게시판기능구현

Conversation

@imchanyang
Copy link
Copy Markdown
Member

개요 ✋

전체/학교 게시판 작성 기능 구현

작업사항 🗒️

AccessToken으로 유저 정보를 어떻게 가져올까요?
Post테이블에 UserId를 넣어야합니다.

변경로직 🛠️

  • 내용을 적어주세요.

@imchanyang imchanyang self-assigned this Aug 23, 2022
Copy link
Copy Markdown
Collaborator

@yejipractice yejipractice left a comment

Choose a reason for hiding this comment

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

진짜 고생 많으셨습니다 늦은 리뷰 죄송해요 ㅠㅠ 어려우셨을텐데 잘 작성하셨네요 특히 서비스는 아주 굿굿 : )

@Column(nullable = true)
private Long schoolId;
@ManyToOne
@JoinColumn(name = "schoolId", nullable = true)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

매핑 잘 하셨는데 지금 언뜻 서치해보니까 fk null이면 에러가 난다는.... 설계를 다시 해봐야겠네요 ㅠㅠㅠ

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fk null 허용되지 않나요? JPA라서 그런가요??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

jpa라서 그런건 아니고.. 아 fk가 pk 동시일때 null허용은 안되는구나 원래 db상으로는... 음 고민이되네요 null이 좋은 방식은 아닌 것 같긴 해요 ㅠㅠ 고민고민

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

음 더 알아보겠습니다. @yejipractice

Copy link
Copy Markdown
Member Author

@imchanyang imchanyang Aug 28, 2022

Choose a reason for hiding this comment

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

  1. Post의 schooId 컬럼에 값을 전부(전체/학교) 다 넣어준다.
  2. Post의 schoolId 컬럼을 빼고 필요할 때 마다 User를 통해 조회한다.

정도 고민이 있는 것 같습니다.

개발하고 있는데 schoolID가 NULL이 되면 코드가 많아지기도 했습니다..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. 둘의 테이블을 나눠버린다?

@yejipractice yejipractice linked an issue Aug 25, 2022 that may be closed by this pull request
5 tasks
Copy link
Copy Markdown
Collaborator

@yejipractice yejipractice left a comment

Choose a reason for hiding this comment

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

고생하셨어요 코코 자꾸 수정 사항만 말씀 드리는 것 같아 죄송해요 ㅠㅠ 그래도 코코 코드가 점점 좋아보여요~! 고생하셨습니다 👍 💯

@@ -46,6 +51,7 @@ public PostsResponseDto saveEntire(String email, PostsSaveRequestDto requestDto)
@Transactional
public PostsResponseDto saveSchool(String email, PostsSaveRequestDto requestDto, Long schoolId) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

제가 말씀 드린 건 all entire 보다는 위에 saveSchool 보시면 학교를 저장한다는 의미로 보이거든요? 로직은 학교 게시글 저장인데? 그런 점에서 메소드 명이 조금 수정이 필요해보인다라고 말씀드린거였습니다! saveAll도 보시면 모두 저장한다는 걸로 해석되잖아요? 사실 전체 게시판에 글을 저장하는 건데.. 이 부분에 대해 어떻게 생각하실까요?? 고민한 흔적이 보여서 고생하셨어요ㅠㅠ!

throw new CPostNotFoundException();
}

System.out.println(new PostsResponseDto(post.get()));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코드 올릴 때에는 println은 빼주셔야 합니다~!


List<PostsResponseDto> postsResponseDtos = new ArrayList<>();

for (int i = 0; i < posts.size(); i++) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

이 부분은 .. 음 사실 문법적으로 맞지만 다르게 거의 쓰시거든요? 자바 공부해보시고 싶으시면 stream.map 한번 적용해보는 건 어떨까요? 해보시고 궁금한 점 있으시면 질문 주세용!!


private String schoolName;

private String title;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코드 좋습니다!! 다만 api문서를 그렇게 작성했던 것 같긴 한데 순간 response로 모두 보내줘야 할까 싶은데 .. 어떻게 생각하세요? 모두 보내줘야겠다 싶으시면 이부분은 수정안하셔도 됩니다!

@@ -45,9 +48,9 @@ public class Post extends TimeStamped {
private Status status;

@Builder
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

빌더는 빼주세요~!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 게시판 기능 구현

2 participants