1 import { I18n } from '@ngx-translate/i18n-polyfill'
2 import { Validators } from '@angular/forms'
3 import { Injectable } from '@angular/core'
4 import { BuildFormValidator } from '@app/shared'
7 export class VideoValidatorsService {
8 readonly VIDEO_NAME: BuildFormValidator
9 readonly VIDEO_PRIVACY: BuildFormValidator
10 readonly VIDEO_CATEGORY: BuildFormValidator
11 readonly VIDEO_LICENCE: BuildFormValidator
12 readonly VIDEO_LANGUAGE: BuildFormValidator
13 readonly VIDEO_IMAGE: BuildFormValidator
14 readonly VIDEO_CHANNEL: BuildFormValidator
15 readonly VIDEO_DESCRIPTION: BuildFormValidator
16 readonly VIDEO_TAGS: BuildFormValidator
17 readonly VIDEO_SUPPORT: BuildFormValidator
19 constructor (private i18n: I18n) {
22 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
24 'required': this.i18n('Video name is required.'),
25 'minlength': this.i18n('Video name must be at least 3 characters long.'),
26 'maxlength': this.i18n('Video name cannot be more than 120 characters long.')
30 this.VIDEO_PRIVACY = {
31 VALIDATORS: [ Validators.required ],
33 'required': this.i18n('Video privacy is required.')
37 this.VIDEO_CATEGORY = {
42 this.VIDEO_LICENCE = {
47 this.VIDEO_LANGUAGE = {
57 this.VIDEO_CHANNEL = {
58 VALIDATORS: [ Validators.required ],
60 'required': this.i18n('Video channel is required.')
64 this.VIDEO_DESCRIPTION = {
65 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ],
67 'minlength': this.i18n('Video description must be at least 3 characters long.'),
68 'maxlength': this.i18n('Video description cannot be more than 10000 characters long.')
73 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
75 'minlength': this.i18n('A tag should be more than 2 characters long.'),
76 'maxlength': this.i18n('A tag should be less than 30 characters long.')
80 this.VIDEO_SUPPORT = {
81 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(500) ],
83 'minlength': this.i18n('Video support must be at least 3 characters long.'),
84 'maxlength': this.i18n('Video support cannot be more than 500 characters long.')