You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
912 B

  1. const NAME_MIN = 3;
  2. const NAME_MAX = 60;
  3. const PASSWORD_MIN = 6;
  4. const PASSWORD_MAX = 30;
  5. // Errors constant name is created from:
  6. // 1: uppercase input name + _ + (eg: NAME)
  7. // 2: error type serverd by joi + _ + (eg: MIN)
  8. // 3: ERROR
  9. // 4: final constant name: NAME_MIN_ERROR
  10. const NAME_MIN_ERROR = `Name length must be at least ${NAME_MIN} characters long`;
  11. const NAME_MAX_ERROR = `Name length must be less than or equal to ${NAME_MAX} characters long`;
  12. const PASSWORD_MAX_ERROR = `Password length must be less than or equal to ${PASSWORD_MAX} characters long`;
  13. const PASSWORD_MIN_ERROR = `Password length must be at least ${PASSWORD_MIN} characters long`;
  14. const USERNAME_EMAIL_ERROR = 'Email must be a valid email address';
  15. module.exports = {
  16. NAME_MIN,
  17. NAME_MAX,
  18. PASSWORD_MAX,
  19. PASSWORD_MIN,
  20. NAME_MIN_ERROR,
  21. NAME_MAX_ERROR,
  22. PASSWORD_MAX_ERROR,
  23. PASSWORD_MIN_ERROR,
  24. USERNAME_EMAIL_ERROR,
  25. };