Changed Collection documents to documentStructure and other WIP stuff

This commit is contained in:
Jori Lallo
2017-06-04 14:40:27 -07:00
parent 9631e58e65
commit c229369efd
6 changed files with 131 additions and 192 deletions

View File

@ -1,3 +1,4 @@
// @flow
import slug from 'slug';
import _ from 'lodash';
import randomstring from 'randomstring';
@ -98,6 +99,13 @@ const Document = sequelize.define(
const slugifiedTitle = slugify(this.title);
return `/d/${slugifiedTitle}-${this.urlId}`;
},
toJSON() {
return {
id: this.id,
title: this.title,
url: this.getUrl(),
};
},
},
}
);