Update API documentation to reflect customer authorization changes
- Changed tags from "Customers-Mobile" to "Customers-Authorization" in Swagger documentation for customer logout and profile retrieval endpoints. - Updated the Company entity to replace CustomerID with OwnerCustomerID to better represent ownership. - Removed obsolete customer assignment methods and related forms from the company domain, streamlining the codebase. - Adjusted customer forms to include CompanyID instead of CompanyName for better consistency in customer management. - Enhanced Swagger documentation to accurately reflect the new structure and authorization details for customer-related endpoints.
This commit is contained in:
@@ -123,7 +123,6 @@ func (s *customerService) CreateCustomer(ctx context.Context, form *CreateCustom
|
||||
Password: string(hashedPassword),
|
||||
Phone: form.Phone,
|
||||
Mobile: form.Mobile,
|
||||
CompanyName: form.CompanyName,
|
||||
RegistrationNumber: form.RegistrationNumber,
|
||||
TaxID: form.TaxID,
|
||||
Industry: form.Industry,
|
||||
@@ -211,15 +210,6 @@ func (s *customerService) UpdateCustomer(ctx context.Context, id string, form *U
|
||||
customer.Username = *form.Username
|
||||
}
|
||||
|
||||
// Check if company name already exists (if changing company name)
|
||||
if form.CompanyName != nil && *form.CompanyName != *customer.CompanyName {
|
||||
existingCustomer, _ := s.repository.GetByCompanyName(ctx, *form.CompanyName)
|
||||
if existingCustomer != nil {
|
||||
return nil, errors.New("company with this name already exists")
|
||||
}
|
||||
customer.CompanyName = form.CompanyName
|
||||
}
|
||||
|
||||
// Check if registration number already exists (if changing)
|
||||
if form.RegistrationNumber != nil && *form.RegistrationNumber != *customer.RegistrationNumber {
|
||||
existingCustomer, _ := s.repository.GetByRegistrationNumber(ctx, *form.RegistrationNumber)
|
||||
@@ -576,7 +566,7 @@ func (s *customerService) CreateCustomerMobile(ctx context.Context, form *Create
|
||||
Password: "", // Will be set after hashing
|
||||
Phone: form.Phone,
|
||||
Mobile: form.Mobile,
|
||||
CompanyName: form.CompanyName,
|
||||
CompanyID: form.CompanyID,
|
||||
Industry: form.Industry,
|
||||
IsVerified: false,
|
||||
IsCompliant: false,
|
||||
@@ -647,8 +637,8 @@ func (s *customerService) UpdateCustomerMobile(ctx context.Context, id string, f
|
||||
customer.Mobile = form.Mobile
|
||||
}
|
||||
|
||||
if form.CompanyName != nil {
|
||||
customer.CompanyName = form.CompanyName
|
||||
if form.CompanyID != nil {
|
||||
customer.CompanyID = form.CompanyID
|
||||
}
|
||||
|
||||
if form.Industry != nil {
|
||||
|
||||
Reference in New Issue
Block a user