update
This commit is contained in:
1 parent
261e842802
commit
0485a4acea
122 files changed
+4866
-3842
No files matched your search
@@ -19,7 +19,7 @@ export default function (app) {
|
||||
function *(type) {
|
||||
let types = {
|
||||
'document': ['documents', {type: 'document'}, populateDocPreview],
|
||||
'award': ['awards', {}, populateDocPreview]
|
||||
'award': ['documents', {type: 'award'}, populateDocPreview]
|
||||
};
|
||||
|
||||
if (type in types) {
|
||||
|
||||
+24
-4
@@ -11,19 +11,39 @@ export default function (app) {
|
||||
|
||||
app.use(route.get('/events', json(
|
||||
function *() {
|
||||
let limit = parseInt(this.query['limit']) || 10;
|
||||
let skip = parseInt(this.query['skip']) || 0;
|
||||
|
||||
let query = {};
|
||||
let events = yield c('events')
|
||||
let documents = yield c('events')
|
||||
.find(query)
|
||||
.sort({date: -1})
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.toArray();
|
||||
|
||||
this.body = events
|
||||
.sort(sortByDate);
|
||||
let total = yield c('events')
|
||||
.find(query).count();
|
||||
|
||||
this.body = {
|
||||
skip: skip,
|
||||
limit: limit,
|
||||
total: total,
|
||||
data: documents
|
||||
};
|
||||
|
||||
//this.body = events
|
||||
// .sort(sortByDate);
|
||||
}
|
||||
)));
|
||||
|
||||
app.use(route.get('/event/:event', json(
|
||||
function *(event) {
|
||||
this.body = yield c('events').findOne({id: event});
|
||||
let document = yield c('events').findOne({id: event});
|
||||
if (!document) {
|
||||
document = yield c('timeline').findOne({id: event});
|
||||
}
|
||||
this.body = document;
|
||||
}
|
||||
)));
|
||||
};
|
||||
Reference in new issue
Block a user