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:
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user