Implement phone number validation for customer and user registration and updates

Added functionality to check for existing customers and users by phone number during registration and updates. Updated the handler, service, and repository layers to include phone number checks, ensuring unique phone numbers across customers and users.
This commit is contained in:
Mazyar
2026-06-06 12:03:04 +03:30
parent 5af3bfaa1a
commit 0da0c8b8c9
5 changed files with 75 additions and 0 deletions
+2
View File
@@ -55,6 +55,7 @@ func (h *Handler) CreateCustomer(c echo.Context) error {
if err != nil {
if err.Error() == "customer with this email already exists" ||
err.Error() == "customer with this username already exists" ||
err.Error() == "customer with this phone number already exists" ||
err.Error() == "company with this name already exists" ||
err.Error() == "company with this registration number already exists" ||
err.Error() == "company with this tax ID already exists" {
@@ -128,6 +129,7 @@ func (h *Handler) UpdateCustomer(c echo.Context) error {
}
if err.Error() == "customer with this email already exists" ||
err.Error() == "customer with this username already exists" ||
err.Error() == "customer with this phone number already exists" ||
err.Error() == "company with this name already exists" ||
err.Error() == "company with this registration number already exists" ||
err.Error() == "company with this tax ID already exists" {