2021-08-27 14:32:44 +02:00
|
|
|
import express from 'express'
|
2021-06-03 17:33:44 +02:00
|
|
|
import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
|
2022-11-15 14:41:55 +01:00
|
|
|
import { forceNumber } from '@shared/core-utils'
|
2021-07-16 10:42:24 +02:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2021-06-03 17:33:44 +02:00
|
|
|
|
|
|
|
async function doesChangeVideoOwnershipExist (idArg: number | string, res: express.Response) {
|
2022-11-15 14:41:55 +01:00
|
|
|
const id = forceNumber(idArg)
|
2021-06-03 17:33:44 +02:00
|
|
|
const videoChangeOwnership = await VideoChangeOwnershipModel.load(id)
|
|
|
|
|
|
|
|
if (!videoChangeOwnership) {
|
|
|
|
res.fail({
|
|
|
|
status: HttpStatusCode.NOT_FOUND_404,
|
|
|
|
message: 'Video change ownership not found'
|
|
|
|
})
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
res.locals.videoChangeOwnership = videoChangeOwnership
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
doesChangeVideoOwnershipExist
|
|
|
|
}
|