Move star out of editor into documentpreview (#174)

* Move star out of editor into documentpreview

* 💚
This commit is contained in:
Tom Moor
2017-08-02 20:45:09 -07:00
committed by GitHub
parent 09b0f9f860
commit ca35cee841
7 changed files with 61 additions and 70 deletions

View File

@ -40,7 +40,19 @@ router.post('documents.viewed', auth(), pagination(), async ctx => {
const views = await View.findAll({
where: { userId: user.id },
order: [[sort, direction]],
include: [{ model: Document, required: true }],
include: [
{
model: Document,
include: [
{
model: Star,
as: 'starred',
where: { userId: user.id },
required: false,
},
],
},
],
offset: ctx.state.pagination.offset,
limit: ctx.state.pagination.limit,
});