Lo que quiero: obtener un registro de la base de datos en función de su ID (UUID) y recuperar los registros anteriores y siguientes también
Asociaciones : posts N:M categories, posts 1:N comments, posts N:1 users, posts N:M tags, posts 1:N post_views
Solución actual:
const post = await PostModel.findByPk(id, { include: [ { model: CategoryModel, attributes: ['title'] }, { model: TagModel }, { model: CommentModel, include: { model: UserModel } }, { model: PostViewModel }, { model: UserModel, attributes: ['fullname', 'id', 'avatar'] } ] }); const nextPost = await PostModel.findOne({ where: { createdAt: { [Op.gt]: post.createdAt }} const prevPost = await PostModel.findOne({ where: { createdAt: { [Op.lt]: post.createdAt }} });pero creo que esto no es eficiente y bueno.