summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 => {