summaryrefslogtreecommitdiff
path: root/bucky
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-15 07:52:01 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-15 07:52:01 +0100
commitde13221a33fe4c079b82588c9d20febefc39abb3 (patch)
treead035585d30f7df47f4852a58fb79867188d073d /bucky
parent6ff7fbaf47792b20762271d006e3580b35745556 (diff)
rekt
Diffstat (limited to 'bucky')
-rw-r--r--bucky/app/federate.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/bucky/app/federate.js b/bucky/app/federate.js
index e5843d7..8a15aee 100644
--- a/bucky/app/federate.js
+++ b/bucky/app/federate.js
@@ -4,10 +4,10 @@ var db = require('../db')
module.exports = {
route: (app) => {
- app.put('/raw/import/thread/', importRaw('thread', db.Thread), (req, res) => res.send({ status: 'ok' }))
- app.put('/raw/import/keyword/', importRaw('keyword', db.Keyword), (req, res) => res.send({ status: 'ok' }))
- app.put('/raw/import/file/', importRaw('file', db.File), (req, res) => res.send({ status: 'ok' }))
- app.put('/raw/import/comment/', importRaw('comment', db.Comment), (req, res) => res.send({ status: 'ok' }))
+ app.put('/raw/import/thread/', importRaw('thread', 'Thread'), (req, res) => res.send({ status: 'ok' }))
+ app.put('/raw/import/keyword/', importRaw('keyword', 'Keyword'), (req, res) => res.send({ status: 'ok' }))
+ app.put('/raw/import/file/', importRaw('file', 'File'), (req, res) => res.send({ status: 'ok' }))
+ app.put('/raw/import/comment/', importRaw('comment', 'Comment'), (req, res) => res.send({ status: 'ok' }))
app.get('/raw/export/thread/:id', exportThread, (req, res) => res.send({ status: 'ok' }))
app.get('/raw/export/keyword/:keyword', exportKeyword, (req, res) => res.send({ status: 'ok' }))
@@ -15,7 +15,7 @@ module.exports = {
function importRaw (type, model) {
return (req, res, next) => {
console.log('importing', type, req.body.id)
- new model(req.body).save().then((el) => {
+ new db[model] (req.body).save().then((el) => {
res.el = el;
next()
}).catch(e => {