aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-ownership.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/video-ownership.ts')
-rw-r--r--server/helpers/custom-validators/video-ownership.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/video-ownership.ts b/server/helpers/custom-validators/video-ownership.ts
index ed5f8cc2f..ee3cebe10 100644
--- a/server/helpers/custom-validators/video-ownership.ts
+++ b/server/helpers/custom-validators/video-ownership.ts
@@ -2,13 +2,14 @@ import { Response } from 'express'
2import { VideoChangeOwnershipModel } from '../../models/video/video-change-ownership' 2import { VideoChangeOwnershipModel } from '../../models/video/video-change-ownership'
3import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership' 3import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
4import { MUserId } from '@server/types/models' 4import { MUserId } from '@server/types/models'
5import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
5 6
6export async function doesChangeVideoOwnershipExist (idArg: number | string, res: Response) { 7export async function doesChangeVideoOwnershipExist (idArg: number | string, res: Response) {
7 const id = parseInt(idArg + '', 10) 8 const id = parseInt(idArg + '', 10)
8 const videoChangeOwnership = await VideoChangeOwnershipModel.load(id) 9 const videoChangeOwnership = await VideoChangeOwnershipModel.load(id)
9 10
10 if (!videoChangeOwnership) { 11 if (!videoChangeOwnership) {
11 res.status(404) 12 res.status(HttpStatusCode.NOT_FOUND_404)
12 .json({ error: 'Video change ownership not found' }) 13 .json({ error: 'Video change ownership not found' })
13 .end() 14 .end()
14 15
@@ -24,7 +25,7 @@ export function checkUserCanTerminateOwnershipChange (user: MUserId, videoChange
24 return true 25 return true
25 } 26 }
26 27
27 res.status(403) 28 res.status(HttpStatusCode.FORBIDDEN_403)
28 .json({ error: 'Cannot terminate an ownership change of another user' }) 29 .json({ error: 'Cannot terminate an ownership change of another user' })
29 .end() 30 .end()
30 return false 31 return false