I have a SQL query (using postgreSQL) that I need to write as a sequelize query in node.js.
Query:
select rd.id AS question_id, count(1) as viewCount,max(vl.timestamp) AS last_viewed, cu.email, cu.first_name, cu.last_name, rd.name as CardName, rd.description as DashboardDescription
from core_user cu
INNER JOIN view_log vl on vl.user_id = cu.id
INNER JOIN report_card rd on rd.id = vl.model_id
where vl.model='card'
GROUP BY cu.email, cu.first_name, cu.last_name, rd.name, rd.description, rd.id
ORDER BY last_viewed DESC```