This commit is contained in:
tmshv committed 2016-11-11 02:36:03 +03:00
1 parent be398bf5ce
commit f121eff445
38 files changed
+498 -267

No files matched your search

+4 -9
View File
@@ -1,9 +1,8 @@
import compose from 'koa-compose';
import co from 'co';
import route from 'koa-route';
import {json} from './';
import {getSchedule, getScheduleList, populateSchedule} from '../core/schedule';
import {getSchedule, getSchedules} from '../core/schedule';
export default function () {
return compose([
@@ -16,11 +15,12 @@ function list() {
return route.get('/schedule/list', json(
async(ctx) => {
ctx.type = 'application/json';
let data = await getScheduleList();
const data = await getSchedules();
if (!data) ctx.status = 404;
else ctx.body = data;
}
))
));
}
function schedule() {
@@ -34,11 +34,6 @@ function schedule() {
return;
}
let doPopulate = ctx.query.populate || false;
if (doPopulate) {
data.schedule = await populateSchedule(data.schedule);
}
ctx.body = data;
}
))