From bf1f650817dadfd5eeee9e5e0b6b6938c136e25d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Dec 2017 10:50:07 +0100 Subject: Add comments controller --- server/helpers/custom-validators/video-comments.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 server/helpers/custom-validators/video-comments.ts (limited to 'server/helpers') diff --git a/server/helpers/custom-validators/video-comments.ts b/server/helpers/custom-validators/video-comments.ts new file mode 100644 index 000000000..2b3f66063 --- /dev/null +++ b/server/helpers/custom-validators/video-comments.ts @@ -0,0 +1,16 @@ +import 'express-validator' +import 'multer' +import * as validator from 'validator' +import { CONSTRAINTS_FIELDS } from '../../initializers' + +const VIDEO_COMMENTS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_COMMENTS + +function isValidVideoCommentText (value: string) { + return value === null || validator.isLength(value, VIDEO_COMMENTS_CONSTRAINTS_FIELDS.TEXT) +} + +// --------------------------------------------------------------------------- + +export { + isValidVideoCommentText +} -- cgit v1.2.3