From 8b60ae72036a8045ce30c0972b13bfb3a730094d Mon Sep 17 00:00:00 2001 From: HerrHase Date: Wed, 27 Jul 2022 23:36:52 +0200 Subject: [PATCH] adding --- packages/server/http/comment.js | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 packages/server/http/comment.js diff --git a/packages/server/http/comment.js b/packages/server/http/comment.js new file mode 100644 index 0000000..c8c6ea2 --- /dev/null +++ b/packages/server/http/comment.js @@ -0,0 +1,36 @@ +import CommentStore from './../stores/comment.js' +import path from 'path' + +/** + * post + * + * @author Björn Hase + * @license http://opensource.org/licenses/MIT The MIT License + * @link https://gitea.node001.net/HerrHase/super-fastify-directus.git + * + */ + +export default async function(fastify, opts) { + + /** + * handle single post + * + * @param {object} request + * @param {object} response + * + */ + fastify.post('/', async function(request, response) { + + const commentStore = new CommentStore() + + const comment = await commentStore.post({ + 'belongs_to' : { + 'collection' : request.body.collection, + 'collection_id' : request.body.uuid + }, + 'name' : request.body.name, + 'content' : request.body.content + }) + + }) +} \ No newline at end of file