강의

멘토링

로드맵

Inflearn Community Q&A

oridori2705's profile image
oridori2705

asked

Node and React series that you can learn by following - Creating a Reddit site (NextJS) (Pages Router)

Get Post Comments

댓글 리스트 불러오는 핸들러에서

Written on

·

599

0

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.

 

이 부분에서 Comment DB에 postID가 언제 저장된 것일까요??

댓글 생성 부분에서는 Post 정보만 저장하지 않았나요??

 

Post정보를 저장하면 postId가 자동저장되는건가요??

댓글을 생성하면 해당 댓글의 postId는 Null값이 아닌가요?

reactnode.jspostgresqldockertypescript클론코딩next.js

Quiz

53% of people got it wrong. Give it a try!

What is the main web standard feature used in the comment input form to prevent page refresh?

async/await

preventDefault

stopPropagation

fetch API

Answer 1

0

@ManyToOne / @OneToMany 관계에서는 @JoinColumn을 생략할 수 있습니다. @ManyToOne을 설정한 엔터티에 FK와 relationId가 생성됩니다.

해당 내용은 강의 중반부인가? 그쯤에 강사님께서 설명 해주십니다.
즉, 생략 안한다면 아래 코드입니다.

@ManyToOne(() => Post, (post) => post.comments, { nullable: true })
@JoinColumn({ name: 'postId', referencedColumnName: 'id' })
post: Post;

감사합니다

 

oridori2705's profile image
oridori2705

asked

Ask a question