Use map instead of pluck (lodash)
This commit is contained in:
parent
2df82d42cb
commit
a4c1575197
|
@ -1,7 +1,7 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const pluck = require('lodash-node/compat/collection/pluck')
|
const map = require('lodash-node/modern/collection/map')
|
||||||
|
|
||||||
const middleware = require('../../../middlewares')
|
const middleware = require('../../../middlewares')
|
||||||
const secureMiddleware = middleware.secure
|
const secureMiddleware = middleware.secure
|
||||||
|
@ -43,7 +43,7 @@ function addRemoteVideos (req, res, next) {
|
||||||
|
|
||||||
function removeRemoteVideo (req, res, next) {
|
function removeRemoteVideo (req, res, next) {
|
||||||
const url = req.body.signature.url
|
const url = req.body.signature.url
|
||||||
const magnetUris = pluck(req.body.data, 'magnetUri')
|
const magnetUris = map(req.body.data, 'magnetUri')
|
||||||
|
|
||||||
videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) {
|
videos.removeRemotesOfByMagnetUris(url, magnetUris, function (err) {
|
||||||
if (err) return next(err)
|
if (err) return next(err)
|
||||||
|
|
|
@ -13,8 +13,8 @@ const reqValidatorsVideos = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function videosAdd (req, res, next) {
|
function videosAdd (req, res, next) {
|
||||||
req.checkFiles('input_video[0].originalname', 'Should have an input video').notEmpty()
|
req.checkFiles('videofile[0].originalname', 'Should have an input video').notEmpty()
|
||||||
req.checkFiles('input_video[0].mimetype', 'Should have a correct mime type').matches(/video\/(webm)|(mp4)|(ogg)/i)
|
req.checkFiles('videofile[0].mimetype', 'Should have a correct mime type').matches(/video\/(webm)|(mp4)|(ogg)/i)
|
||||||
req.checkBody('name', 'Should have a name').isLength(1, 50)
|
req.checkBody('name', 'Should have a name').isLength(1, 50)
|
||||||
req.checkBody('description', 'Should have a description').isLength(1, 250)
|
req.checkBody('description', 'Should have a description').isLength(1, 250)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue