1 import express from 'express'
2 import { param } from 'express-validator'
3 import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4 import { isIdValid } from '../../../helpers/custom-validators/misc'
5 import { VideoShareModel } from '../../../models/video/video-share'
6 import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'
8 const videosShareValidator = [
9 isValidVideoIdParam('id'),
14 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
15 if (areValidationErrors(req, res)) return
16 if (!await doesVideoExist(req.params.id, res)) return
18 const video = res.locals.videoAll
20 const share = await VideoShareModel.load(req.params.actorId, video.id)
22 return res.status(HttpStatusCode.NOT_FOUND_404)
26 res.locals.videoShare = share
31 // ---------------------------------------------------------------------------