Fixed ordering issue on dashboard

This commit is contained in:
Jori Lallo
2016-08-21 23:40:57 -07:00
parent 16436dc9af
commit e7301aeb3e
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import Router from 'koa-router'; import Router from 'koa-router';
import httpErrors from 'http-errors'; import httpErrors from 'http-errors';
import _orderBy from 'lodash.orderby'; import _ from 'lodash';
import auth from './authentication'; import auth from './authentication';
import pagination from './middlewares/pagination'; import pagination from './middlewares/pagination';
@ -71,7 +71,7 @@ router.post('collections.list', auth(), pagination(), async (ctx) => {
return data.push(await presentCollection(ctx, atlas, true)); return data.push(await presentCollection(ctx, atlas, true));
})); }));
data = _orderBy(data, ['updatedAt'], ['desc']); data = _.orderBy(data, ['updatedAt'], ['desc']);
ctx.body = { ctx.body = {
pagination: ctx.state.pagination, pagination: ctx.state.pagination,

View File

@ -100,6 +100,8 @@ export function presentCollection(ctx, collection, includeRecentDocuments=false)
name: collection.name, name: collection.name,
description: collection.description, description: collection.description,
type: collection.type, type: collection.type,
createdAt: collection.createdAt,
updatedAt: collection.updatedAt,
}; };
if (collection.type === 'atlas') data.navigationTree = collection.navigationTree; if (collection.type === 'atlas') data.navigationTree = collection.navigationTree;