logs-content: Added move up/down mutations

This commit is contained in:
2018-09-30 12:02:53 +02:00
parent ed01006b21
commit 6cb1043004
6 changed files with 106 additions and 4 deletions
+22 -1
View File
@@ -23,4 +23,25 @@ class Post {
}
}
module.exports = {Post}
class PostAPI {
/**
* Call `movePost(input)` mutation, returns the id and position of all affected posts.
*
* @param {{id:string, toPosition: number}} input
* @returns {Promise<{id:string, position:number}[]>}
*/
move(input) {
return query(`
mutation MovePost($input: PostMoveInput!) {
movePost(input: $input) {
id
position
}
}
`, {input}, {permissions: ["post.move"]}).then(({movePost}) => {
return movePost
})
}
}
module.exports = {Post, postApi: new PostAPI}