Display document views (#849)

* Display who has viewed a document in the header

* Add overflow, display of WHEN last viewed
Cleanup old document attributes
Add firstViewedAt, lastViewedAt to API response

* Cleanup

* Added: API documentation for views endpoints

* Include views for deleted users
This commit is contained in:
Tom Moor
2019-01-08 22:49:20 -08:00
committed by GitHub
parent 11b0ac0c66
commit c78bf3c4bf
14 changed files with 216 additions and 123 deletions

View File

@ -148,7 +148,7 @@ router.post('documents.starred', auth(), pagination(), async ctx => {
const user = ctx.state.user;
const collectionIds = await user.collectionIds();
const views = await Star.findAll({
const stars = await Star.findAll({
where: {
userId: user.id,
},
@ -175,7 +175,7 @@ router.post('documents.starred', auth(), pagination(), async ctx => {
});
const data = await Promise.all(
views.map(view => presentDocument(ctx, view.document))
stars.map(star => presentDocument(ctx, star.document))
);
ctx.body = {