0
Sequelize에 대한 쿼리를 만들고 db의 각 사용자를 기반으로 쿼리를 실행하려고합니다. 나는 약속으로이 foreach 루프를 설정하는 방법을하지 확신 때문에 foreach 루프가 끝난 후 나는 작업을 수행 할 수 있습니다 ....비동기 작업에 대한 루핑
users.forEach(user => {
let userHideCount = 0
Comment_List.findAll({
where: {user_id:user}, attributes: ['user_id','cid'], include: [
{model: Comment, attributes: ['verb','created_time']}
],
order: [[ Comment, 'created_time', 'DESC' ]],
})
.then(cl => {
cl.forEach(comment => comment.get({plain:true}).comments[0].verb === 'hide' ? userHideCount++ : null)
hiddenCounts[user] = userHideCount
})
})
아니면 이것에 대해 갈 수있는 더 좋은 방법이 ... 어떤 도움이 크게 감사드립니다!