Added atlases.create API

This commit is contained in:
Jori Lallo
2016-07-21 22:06:30 -07:00
parent 3e5c5874d7
commit e5b175a86e

View File

@@ -9,6 +9,28 @@ import { Team, Atlas } from '../models';
const router = new Router();
router.post('atlases.create', auth(), async (ctx) => {
let {
name,
description,
type,
} = ctx.request.body;
ctx.assertPresent(name, 'name is required');
const user = ctx.state.user;
const atlas = await Atlas.create({
name,
description,
type: type || 'atlas',
teamId: user.teamId,
});
ctx.body = {
data: await presentAtlas(atlas, true),
};
});
router.post('atlases.info', auth(), async (ctx) => {
let { id } = ctx.request.body;
ctx.assertPresent(id, 'id is required');