diff --git a/server/api/atlases.js b/server/api/collections.js similarity index 100% rename from server/api/atlases.js rename to server/api/collections.js diff --git a/server/api/index.js b/server/api/index.js index 302eb195..11f8fc09 100644 --- a/server/api/index.js +++ b/server/api/index.js @@ -6,7 +6,7 @@ import Sequelize from 'sequelize'; import auth from './auth'; import user from './user'; -import atlases from './atlases'; +import collections from './collections'; import documents from './documents'; import validation from './validation'; @@ -44,7 +44,7 @@ api.use(validation()); router.use('/', auth.routes()); router.use('/', user.routes()); -router.use('/', atlases.routes()); +router.use('/', collections.routes()); router.use('/', documents.routes()); // Router is embedded in a Koa application wrapper, because koa-router does not diff --git a/server/models/Atlas.js b/server/models/Atlas.js index f8af3815..f6f778d2 100644 --- a/server/models/Atlas.js +++ b/server/models/Atlas.js @@ -14,7 +14,7 @@ const Atlas = sequelize.define('atlas', { type: { type: DataTypes.STRING, validate: { isIn: allowedAtlasTypes }}, /* type: atlas */ - atlasStructure: DataTypes.JSONB, + navigationTree: DataTypes.JSONB, }, { tableName: 'atlases', hooks: { @@ -32,8 +32,8 @@ const Atlas = sequelize.define('atlas', { }, instanceMethods: { async getStructure() { - if (this.atlasStructure) { - return this.atlasStructure; + if (this.navigationTree) { + return this.navigationTree; } const getNodeForDocument = async (document) => { @@ -122,7 +122,7 @@ const Atlas = sequelize.define('atlas', { throw new Error('Invalid navigation tree'); } - this.atlasStructure = newTree; + this.navigationTree = newTree; await this.save(); return newTree; @@ -147,7 +147,7 @@ const Atlas = sequelize.define('atlas', { return node; }; - this.atlasStructure = insertNode(this.atlasStructure); + this.navigationTree = insertNode(this.navigationTree); } } }); diff --git a/server/presenters.js b/server/presenters.js index 2441dcc0..49218b1d 100644 --- a/server/presenters.js +++ b/server/presenters.js @@ -32,8 +32,7 @@ export function presentAtlas(atlas, includeRecentDocuments=false) { } if (atlas.type === 'atlas') { - // Todo replace with `.atlasStructure` - data.structure = await atlas.getStructure(); + data.navigationTree = await atlas.getStructure(); } if (includeRecentDocuments) { diff --git a/src/scenes/Atlas/Atlas.js b/src/scenes/Atlas/Atlas.js index 4310ecc7..d689841a 100644 --- a/src/scenes/Atlas/Atlas.js +++ b/src/scenes/Atlas/Atlas.js @@ -21,7 +21,7 @@ class Atlas extends React.Component { // Forward directly to root document if (data.type === 'atlas') { - History.replace(data.structure.url); + History.replace(data.navigationTree.url); } }) } diff --git a/src/scenes/DocumentScene/DocumentScene.js b/src/scenes/DocumentScene/DocumentScene.js index e9ac2937..e8883207 100644 --- a/src/scenes/DocumentScene/DocumentScene.js +++ b/src/scenes/DocumentScene/DocumentScene.js @@ -115,7 +115,7 @@ class DocumentScene extends React.Component {