Enhance Customer Module with Validation and Username Handling

- Introduced a new ValidationService for customer operations to ensure valid username formats.
- Updated customer service and handler to utilize the new validation service, enhancing input validation during registration and updates.
- Modified CreateCustomerForm and UpdateCustomerForm to enforce username validation rules.
- Adjusted repository indexing to improve search efficiency by refining the text index for customer data.
- Ensured consistent handling of usernames across the customer module, improving overall data integrity and user experience.
This commit is contained in:
n.nakhostin
2025-09-24 12:57:23 +03:30
parent 080c1d18e5
commit 939f940499
6 changed files with 65 additions and 9 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ func NewRepository(mongoManager *orm.ConnectionManager, logger logger.Logger) Re
// Create indexes using the ORM's index management
indexes := []orm.Index{
*orm.CreateUniqueIndex("username_idx", bson.D{{Key: "username", Value: 1}}),
*orm.CreateTextIndex("search_idx", "full_name", "email", "username", "phone"),
*orm.CreateTextIndex("search_idx", "email", "username"),
}
// Create indexes