Added more views and atlas APIs
This commit is contained in:
@@ -4,9 +4,19 @@ import {
|
||||
} from '../sequelize';
|
||||
import Team from './Team';
|
||||
|
||||
const allowedAtlasTypes = [['atlas', 'journal']];
|
||||
|
||||
const Atlas = sequelize.define('atlas', {
|
||||
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
|
||||
name: DataTypes.STRING,
|
||||
description: DataTypes.STRING,
|
||||
type: { type: DataTypes.STRING, validate: { isIn: allowedAtlasTypes }},
|
||||
}, {
|
||||
instanceMethods: {
|
||||
getRecentDocuments() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Atlas.belongsTo(Team);
|
||||
|
||||
@@ -23,6 +23,9 @@ const User = sequelize.define('user', {
|
||||
getJwtToken() {
|
||||
return JWT.sign({ id: this.id }, this.jwtSecret);
|
||||
},
|
||||
async getTeam() {
|
||||
return this.team;
|
||||
}
|
||||
},
|
||||
indexes: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user