Last active
October 16, 2017 21:23
-
-
Save georgesboris/8363d3f74cbe5ab55fd5e68bbe02df45 to your computer and use it in GitHub Desktop.
firebase-app simple action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const paths = require('../paths/paths'); | |
module.exports = { | |
createPost: { | |
id: 'createPost', | |
create: ['postId'], | |
validate: ['title', 'body'], | |
updates: (payload, helpers) => ({ | |
[paths.post(payload.postId)]: { | |
title: payload.title, | |
body: payload.body, | |
createdAt: helpers.now, | |
createdBy: helpers.uid | |
} | |
}) | |
}, | |
updatePost: { | |
id: 'updatePost', | |
validate: ['postId', 'value'], | |
updates: (payload, helpers) => ({ | |
[paths.postBody(payload.postId)]: payload.value | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment