Enhance API documentation and restructure routes for improved clarity

- Updated README.md to include comprehensive Swagger documentation details, highlighting new features and endpoint categories.
- Introduced a new router structure to streamline route registration for admin and public endpoints, enhancing maintainability.
- Updated health check endpoint documentation to reflect comprehensive server status information.
- Enhanced customer and company management routes with improved descriptions and examples in Swagger.
- Refactored customer and user handlers to remove obsolete route registrations, aligning with the new router structure.
- Improved response handling in customer and user services to utilize string IDs consistently.
- Updated validation rules and forms for customer management to support multiple company assignments.
- Enhanced logging practices across services to ensure better traceability and error handling.
This commit is contained in:
n.nakhostin
2025-08-11 18:24:34 +03:30
parent 566fa07574
commit 3e4831c2e7
23 changed files with 3605 additions and 2087 deletions
+25 -8
View File
@@ -2,8 +2,10 @@ package customer
// CreateCustomerForm represents the form for creating a new customer
type CreateCustomerForm struct {
Type string `json:"type" valid:"required,in(individual|company|government)"`
CompanyID *string `json:"company_id,omitempty" valid:"optional,uuid"`
Type string `json:"type" valid:"required,in(individual|company|government)"`
// Company assignments
CompanyIDs []string `json:"company_ids,omitempty" valid:"optional"`
// Individual customer fields
FirstName *string `json:"first_name,omitempty" valid:"optional,length(2|50)"`
@@ -41,8 +43,10 @@ type CreateCustomerForm struct {
// UpdateCustomerForm represents the form for updating a customer
type UpdateCustomerForm struct {
Type *string `json:"type,omitempty" valid:"optional,in(individual|company|government)"`
CompanyID *string `json:"company_id,omitempty" valid:"optional,uuid"`
Type *string `json:"type,omitempty" valid:"optional,in(individual|company|government)"`
// Company assignments
CompanyIDs []string `json:"company_ids,omitempty" valid:"optional"`
// Individual customer fields
FirstName *string `json:"first_name,omitempty" valid:"optional,length(2|50)"`
@@ -154,8 +158,10 @@ type CreateCustomerMobileForm struct {
Password string `json:"password" valid:"required,length(8|128)"`
Phone *string `json:"phone,omitempty" valid:"optional,length(10|20)"`
Mobile *string `json:"mobile,omitempty" valid:"optional,length(10|20)"`
CompanyID *string `json:"company_id,omitempty" valid:"optional,uuid"`
Industry *string `json:"industry,omitempty" valid:"optional,length(2|100)"`
// Company assignments
CompanyIDs []string `json:"company_ids,omitempty" valid:"optional"`
Industry *string `json:"industry,omitempty" valid:"optional,length(2|100)"`
}
type UpdateCustomerMobileForm struct {
@@ -164,8 +170,10 @@ type UpdateCustomerMobileForm struct {
FullName *string `json:"full_name,omitempty" valid:"optional,length(2|100)"`
Phone *string `json:"phone,omitempty" valid:"optional,length(10|20)"`
Mobile *string `json:"mobile,omitempty" valid:"optional,length(10|20)"`
CompanyID *string `json:"company_id,omitempty" valid:"optional,uuid"`
Industry *string `json:"industry,omitempty" valid:"optional,length(2|100)"`
// Company assignments
CompanyIDs []string `json:"company_ids,omitempty" valid:"optional"`
Industry *string `json:"industry,omitempty" valid:"optional,length(2|100)"`
}
// Customer Authentication DTOs
@@ -204,3 +212,12 @@ type AuthResponse struct {
RefreshToken string `json:"refresh_token"`
ExpiresAt int64 `json:"expires_at"`
}
// Company assignment forms
type AssignCompaniesForm struct {
CompanyIDs []string `json:"company_ids" valid:"required"`
}
type RemoveCompaniesForm struct {
CompanyIDs []string `json:"company_ids" valid:"required"`
}