]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/forms/form-validators/video.ts
45da7df4a53cf27678dc13da4e3b01ac2c74ea82
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-validators / video.ts
1 import { Validators } from '@angular/forms'
2
3 export type ValidatorMessage = {
4 [ id: string ]: {
5 [ error: string ]: string
6 }
7 }
8
9 export const VIDEO_NAME = {
10 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
11 MESSAGES: {
12 'required': 'Video name is required.',
13 'minlength': 'Video name must be at least 3 characters long.',
14 'maxlength': 'Video name cannot be more than 120 characters long.'
15 }
16 }
17
18 export const VIDEO_PRIVACY = {
19 VALIDATORS: [ Validators.required ],
20 MESSAGES: {
21 'required': 'Video privacy is required.'
22 }
23 }
24
25 export const VIDEO_CATEGORY = {
26 VALIDATORS: [ ],
27 MESSAGES: {}
28 }
29
30 export const VIDEO_LICENCE = {
31 VALIDATORS: [ ],
32 MESSAGES: {}
33 }
34
35 export const VIDEO_LANGUAGE = {
36 VALIDATORS: [ ],
37 MESSAGES: {}
38 }
39
40 export const VIDEO_CHANNEL = {
41 VALIDATORS: [ Validators.required ],
42 MESSAGES: {
43 'required': 'Video channel is required.'
44 }
45 }
46
47 export const VIDEO_DESCRIPTION = {
48 VALIDATORS: [ Validators.minLength(3), Validators.maxLength(3000) ],
49 MESSAGES: {
50 'minlength': 'Video description must be at least 3 characters long.',
51 'maxlength': 'Video description cannot be more than 3000 characters long.'
52 }
53 }
54
55 export const VIDEO_TAGS = {
56 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
57 MESSAGES: {
58 'minlength': 'A tag should be more than 2 characters long.',
59 'maxlength': 'A tag should be less than 30 characters long.'
60 }
61 }