Module: utils/validationUtil

Validation Utility for Satoshi Showdown. Provides a comprehensive suite of validation functions for various data types and formats within the application, leveraging the Joi library. This ensures data integrity and conformity to application standards, particularly for user and event data.

Source:

Requires

  • module:joi

Methods

(inner) validateEvent(data) → {Joi.ValidationResult}

Validates event data against the defined schema. Ensures that the provided event data conforms to the structure and rules set in the Event model. Includes validation for new fields like maxParticipants, minParticipants, isOpen, and closedAt. This validation is crucial for maintaining data integrity and consistency in the application.

Parameters:
Name Type Description
data Object

The event data to validate.

Source:
Returns:

The result of the validation.

Type
Joi.ValidationResult

(inner) validateUser(data) → {Joi.ValidationResult}

Validates user data against the defined schema. The password is validated as a plain text string before hashing, ensuring it meets the defined criteria (like minimum length). After validation, the password should be hashed before storing it in the database.

Parameters:
Name Type Description
data Object

The user data to validate.

Source:
Returns:

The result of the validation.

Type
Joi.ValidationResult