]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/forms/form-validators/video.ts
Move video form inside a component
[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: [ Validators.required ],
27 MESSAGES: {
28 'required': 'Video category is required.'
29 }
30 }
31
32 export const VIDEO_LICENCE = {
33 VALIDATORS: [ Validators.required ],
34 MESSAGES: {
35 'required': 'Video licence is required.'
36 }
37 }
38
39 export const VIDEO_LANGUAGE = {
40 VALIDATORS: [ ],
41 MESSAGES: {}
42 }
43
44 export const VIDEO_CHANNEL = {
45 VALIDATORS: [ Validators.required ],
46 MESSAGES: {
47 'required': 'Video channel is required.'
48 }
49 }
50
51 export const VIDEO_DESCRIPTION = {
52 VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(3000) ],
53 MESSAGES: {
54 'required': 'Video description is required.',
55 'minlength': 'Video description must be at least 3 characters long.',
56 'maxlength': 'Video description cannot be more than 3000 characters long.'
57 }
58 }
59
60 export const VIDEO_TAGS = {
61 VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
62 MESSAGES: {
63 'minlength': 'A tag should be more than 2 characters long.',
64 'maxlength': 'A tag should be less than 30 characters long.'
65 }
66 }
67
68 export const VIDEO_FILE = {
69 VALIDATORS: [ Validators.required ],
70 MESSAGES: {
71 'required': 'Video file is required.'
72 }
73 }