X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fserver%2Fredundancy.ts;h=99d1c762b8d1d8f3bff98259c74f3c122bdbc724;hb=171efc48e67498406feb6d7873b3482b41505515;hp=1ced0759e9d0a2d4558f415b5ae22621a07a3993;hpb=4c1def5fd8e9f483238eb38e221f555e2e6bbf07;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/server/redundancy.ts b/server/controllers/api/server/redundancy.ts index 1ced0759e..99d1c762b 100644 --- a/server/controllers/api/server/redundancy.ts +++ b/server/controllers/api/server/redundancy.ts @@ -1,5 +1,10 @@ import * as express from 'express' +import { JobQueue } from '@server/lib/job-queue' +import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' +import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { UserRight } from '../../../../shared/models/users' +import { logger } from '../../../helpers/logger' +import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/redundancy' import { asyncMiddleware, authenticate, @@ -10,15 +15,11 @@ import { videoRedundanciesSortValidator } from '../../../middlewares' import { - listVideoRedundanciesValidator, - updateServerRedundancyValidator, addVideoRedundancyValidator, - removeVideoRedundancyValidator + listVideoRedundanciesValidator, + removeVideoRedundancyValidator, + updateServerRedundancyValidator } from '../../../middlewares/validators/redundancy' -import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/redundancy' -import { logger } from '../../../helpers/logger' -import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' -import { JobQueue } from '@server/lib/job-queue' const serverRedundancyRouter = express.Router() @@ -89,13 +90,13 @@ async function addVideoRedundancy (req: express.Request, res: express.Response) payload }) - return res.sendStatus(204) + return res.status(HttpStatusCode.NO_CONTENT_204).end() } async function removeVideoRedundancyController (req: express.Request, res: express.Response) { await removeVideoRedundancy(res.locals.videoRedundancy) - return res.sendStatus(204) + return res.status(HttpStatusCode.NO_CONTENT_204).end() } async function updateRedundancy (req: express.Request, res: express.Response) { @@ -109,5 +110,5 @@ async function updateRedundancy (req: express.Request, res: express.Response) { removeRedundanciesOfServer(server.id) .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, { err })) - return res.sendStatus(204) + return res.status(HttpStatusCode.NO_CONTENT_204).end() }