Admin endpoints

This commit is contained in:
Jori Lallo
2017-12-26 15:02:26 +02:00
parent a74e90fc09
commit 26d0d815a2
14 changed files with 366 additions and 38 deletions

View File

@ -1,5 +1,6 @@
// @flow
import _ from 'lodash';
import { Op } from 'sequelize';
import { User, Document } from '../models';
import presentUser from './user';
import presentCollection from './collection';
@ -57,7 +58,7 @@ async function present(ctx: Object, document: Document, options: ?Options) {
// This could be further optimized by using ctx.cache
data.collaborators = await User.findAll({
where: {
id: { $in: _.takeRight(document.collaboratorIds, 10) || [] },
id: { [Op.in]: _.takeRight(document.collaboratorIds, 10) || [] },
},
}).map(user => presentUser(ctx, user));