[JITERA] Enhance ToDo Model with Validation
Created by: chi-jitera
Overview
This pull request enhances the existing ToDo model by adding validation to ensure that the title field is not only required but also adheres to specific constraints. Additionally, we will implement validation for the dueDate field to ensure it is a valid date and not in the past.
Changes Made
-
Title Validation:
- The
titlefield is now validated to ensure it is a non-empty string with a maximum length of 100 characters. - This prevents users from entering excessively long titles that could affect the database and UI.
- The
-
Due Date Validation:
- The
dueDatefield is validated to ensure it is a valid date and cannot be set to a date in the past. - This ensures that users can only set future due dates, making the application more user-friendly and logical.
- The
-
Error Handling:
- Added custom error messages for validation failures to provide better feedback to users.
These changes will improve the integrity of the data stored in the ToDo model and enhance the overall user experience.