story-content: Added chapter move option.
the build was successful

This commit is contained in:
2018-10-27 14:57:25 +02:00
parent 1e022d6116
commit adf73a4623
7 changed files with 145 additions and 8 deletions
+23 -5
View File
@@ -21,7 +21,7 @@ class Chapter {
}
}
const chapterApi = {
class ChapterAPI {
/**
* Call `addChapter(input)` mutation, returns the entire object.
*
@@ -46,7 +46,7 @@ const chapterApi = {
return new Chapter(ac.id, ac.title, ac.author, ac.source, ac.createdDate, ac.fictionalDate, ac.editedDate)
})
},
}
/**
* Call `editChapter(input)` mutation, returns editable fields
@@ -70,7 +70,25 @@ const chapterApi = {
return editChapter
})
},
}
/**
* Call `moveChapter(input)` mutation, returns the ID.
*
* @param {{id:string, storyId:string}} input
* @returns {Promise<{id:string}>}
*/
moveChapter(input) {
return query(`
mutation MoveChapter($input: ChapterMoveInput!) {
moveChapter(input: $input) {
id
}
}
`, {input}, {permissions: ["member", "story.move"]}).then(({moveChapter}) => {
return moveChapter
})
}
/**
* Call `removeChapter(input)` mutation, returns only the id
@@ -88,7 +106,7 @@ const chapterApi = {
`, {input}, {permissions: ["member", "story.edit"]}).then(({removeChapter}) => {
return removeChapter
})
},
}
}
module.exports = {Chapter, chapterApi}
module.exports = {Chapter, chapterApi: new ChapterAPI}