From e0ea4b1d550d20271a74f1b84e7b3babeec9e0b3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 17:30:46 +0200 Subject: Implement video channel feeds --- server/middlewares/validators/feeds.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'server/middlewares/validators') diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 6a8cfce86..b55190559 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts @@ -1,11 +1,12 @@ import * as express from 'express' import { param, query } from 'express-validator/check' -import { isAccountIdExist, isAccountNameValid, isLocalAccountNameExist } from '../../helpers/custom-validators/accounts' +import { isAccountIdExist, isAccountNameValid } from '../../helpers/custom-validators/accounts' import { join } from 'path' import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' import { logger } from '../../helpers/logger' import { areValidationErrors } from './utils' import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' +import { isVideoChannelExist } from '../../helpers/custom-validators/video-channels' const feedsValidator = [ param('format').optional().custom(isValidRSSFeed).withMessage('Should have a valid format (rss, atom, json)'), @@ -18,11 +19,8 @@ const feedsValidator = [ if (areValidationErrors(req, res)) return - if (req.query.accountId) { - if (!await isAccountIdExist(req.query.accountId, res)) return - } else if (req.query.accountName) { - if (!await isLocalAccountNameExist(req.query.accountName, res)) return - } + if (req.query.accountId && !await isAccountIdExist(req.query.accountId, res)) return + if (req.query.videoChannelId && !await isVideoChannelExist(req.query.videoChannelId, res)) return return next() } -- cgit v1.2.3