From a3ee6fa22dee4b68fcde9cd23708b471db446e11 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Jun 2016 22:39:08 +0200 Subject: Pod model refractoring -> use mongoose api --- server/middlewares/secure.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/middlewares') diff --git a/server/middlewares/secure.js b/server/middlewares/secure.js index ad7b0fbf7..fbaf4d0f2 100644 --- a/server/middlewares/secure.js +++ b/server/middlewares/secure.js @@ -1,8 +1,10 @@ 'use strict' const logger = require('../helpers/logger') +const mongoose = require('mongoose') const peertubeCrypto = require('../helpers/peertubeCrypto') -const Pods = require('../models/pods') + +const Pod = mongoose.model('Pod') const secureMiddleware = { decryptBody: decryptBody @@ -10,7 +12,7 @@ const secureMiddleware = { function decryptBody (req, res, next) { const url = req.body.signature.url - Pods.findByUrl(url, function (err, pod) { + Pod.loadByUrl(url, function (err, pod) { if (err) { logger.error('Cannot get signed url in decryptBody.', { error: err }) return res.sendStatus(500) -- cgit v1.2.3