|
|
@ -0,0 +1,90 @@ |
|
|
|
export const ValidationConstraints = { |
|
|
|
api: { |
|
|
|
movie: { |
|
|
|
search: { |
|
|
|
query: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "The query cannot be blank" |
|
|
|
} |
|
|
|
}, |
|
|
|
year: { |
|
|
|
numericality: { |
|
|
|
onlyInteger: true, |
|
|
|
greaterThan: 0, |
|
|
|
notGreaterThan: "Invalid year", |
|
|
|
notValid: "Invalid year", |
|
|
|
notInteger: "Invalid year" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
login: { |
|
|
|
email: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "An email address is required" |
|
|
|
} |
|
|
|
}, |
|
|
|
password: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "A password is required" |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
register: { |
|
|
|
token: { |
|
|
|
presence: { |
|
|
|
message: "A valid token is required to register" |
|
|
|
}, |
|
|
|
token: { |
|
|
|
message: "A valid token is required to register" |
|
|
|
} |
|
|
|
}, |
|
|
|
name: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "Your name is required" |
|
|
|
}, |
|
|
|
length: { |
|
|
|
maximum: 50, |
|
|
|
tooLong: "Your name cannot exceed 50 characters" |
|
|
|
} |
|
|
|
}, |
|
|
|
email: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "Your email is required" |
|
|
|
}, |
|
|
|
length: { |
|
|
|
maximum: 255, |
|
|
|
tooLong: "An email address cannot exceed 255 characters" |
|
|
|
}, |
|
|
|
email: { |
|
|
|
message: "A valid email address is required" |
|
|
|
} |
|
|
|
}, |
|
|
|
password: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "A password is required" |
|
|
|
}, |
|
|
|
length: { |
|
|
|
minimum: 8, |
|
|
|
tooShort: "Password should be at least 8 characters" |
|
|
|
} |
|
|
|
}, |
|
|
|
retypePassword: { |
|
|
|
presence: { |
|
|
|
allowEmpty: false, |
|
|
|
message: "Re-type your password to confirm it" |
|
|
|
}, |
|
|
|
equality: { |
|
|
|
attribute: "password", |
|
|
|
message: "Passwords must match" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |