인프런 커뮤니티 질문&답변
Likers가 정의되지 않는것 같습니다 ㅜ
작성
·
258
0
안녕하세요 제로초님
강의 듣다 해결이 되지 않는 부분이 있어 질문 남깁니다.
강의 마지막까지 듣고, 서버연결하여 새로고침하여 localhost사이트에 들어가는데,
이러한 에러가 떠서 질문드려요 ㅜ
Likers는 분명히 fullPost 넘길때 넘겼는데
const fullPost = await Post.findOne({
where: { id: post.id },
include: [{
model: Image
}, {
model: Comment,
include: [{
model: User, //댓글 작성자
attributes: ['id', 'nickname']
}]
}, {
model: User, // 게시글 작성자
attributes: ['id', 'nickname']
}, {
model: User, //좋아요 누른사람
as: 'Likers',
attributes: ['id']
}]
})
물론 게시글 불러오는 posts에서도 Likers를 불러오도록 설정 해놨습니다
const posts = await Post.findAll({
limit: 10,
order: [
['createdAt', 'DESC'],
[Comment, 'createdAt', 'DESC']
],
include: [{
model: User,
attributes: ['id', 'nickname']
}, {
model: Image
}, {
model: Comment,
include: [{
model: User,
attributes: ['id', 'nickname'],
}]
}, {
model: User,
as: 'Likers',
attributes: ['id']
}]
})
이렇게요
현재 터미널에서는
이러한 에러가 뜨며 진행이 되지 않고 있습니다.
구글링도 해보고 다양한 루트로 찾아보고있는데 해결이 되지 않아 질문드립니다 ㅜㅜ




