test index, create list

This commit is contained in:
2018-05-20 01:02:38 +03:00
parent 87ec0ac4d4
commit 13f8d02ad4
4 changed files with 49 additions and 4 deletions

View File

@@ -26,9 +26,9 @@ TodoSchema.pre('remove', async function () {
TodoSchema.methods.toJson = function () {
return {
id: this._id,
id: this._id.toString(),
text: this.text,
list: this.list,
list: this.list.toString(),
};
};

View File

@@ -36,7 +36,7 @@ TodoListSchema.pre('remove', async function () {
TodoListSchema.methods.toJson = function () {
const todos = this.populated('todos') ? this.todos.map(todo => todo.toJson()) : this.todos;
return {
id: this._id,
id: this._id.toString(),
name: this.name,
slug: this.slug,
todos,