Refactor company domain by removing customer-related fields and methods

- Removed OwnerCustomerID from Company entity and CompanyResponse to streamline ownership representation.
- Eliminated customer assignment fields from CreateCompanyForm and ListCompaniesForm for clarity.
- Updated repository and service methods to remove GetByCustomerID and CountWithCustomer, simplifying the codebase.
- Adjusted Search method parameters to exclude hasCustomer filter, enhancing search functionality.
- Improved API documentation by removing references to customer assignment in handler comments.
This commit is contained in:
n.nakhostin
2025-08-11 18:31:15 +03:30
parent 3e4831c2e7
commit f5407abbf0
5 changed files with 23 additions and 107 deletions
+8 -18
View File
@@ -26,9 +26,6 @@ type CreateCompanyForm struct {
// Tags for categorization and search
Tags *CompanyTagsForm `json:"tags,omitempty"`
// Customer assignment (for login credentials)
CustomerID *string `json:"customer_id,omitempty" valid:"optional,uuid"`
// Settings
Language *string `json:"language,omitempty" valid:"optional,in(en|ar|fr|es|de|zh|ja|ko)"`
Currency *string `json:"currency,omitempty" valid:"optional,in(USD|EUR|GBP|JPY|CAD|AUD|CHF|CNY|INR|BRL)"`
@@ -81,7 +78,6 @@ type ListCompaniesForm struct {
Categories []string `query:"categories" valid:"optional"`
Keywords []string `query:"keywords" valid:"optional"`
Specializations []string `query:"specializations" valid:"optional"`
HasCustomer *bool `query:"has_customer" valid:"optional"`
EmployeeCountMin *int `query:"employee_count_min" valid:"optional,min(1)"`
EmployeeCountMax *int `query:"employee_count_max" valid:"optional,min(1)"`
AnnualRevenueMin *float64 `query:"annual_revenue_min" valid:"optional,min(0)"`
@@ -106,11 +102,6 @@ type UpdateCompanyVerificationForm struct {
ComplianceNotes *string `json:"compliance_notes,omitempty" valid:"optional,length(0|1000)"`
}
// AssignCustomerForm represents the form for assigning a customer to a company
type AssignCustomerForm struct {
CustomerID string `json:"customer_id" valid:"required,uuid"`
}
// UpdateCompanyTagsForm represents the form for updating company tags
type UpdateCompanyTagsForm struct {
Tags *CompanyTagsForm `json:"tags" valid:"required"`
@@ -199,15 +190,14 @@ type CompanySearchForm struct {
// Company statistics DTOs
type CompanyStatsResponse struct {
TotalCompanies int64 `json:"total_companies"`
ActiveCompanies int64 `json:"active_companies"`
VerifiedCompanies int64 `json:"verified_companies"`
CompaniesWithCustomer int64 `json:"companies_with_customer"`
CompaniesByType map[string]int64 `json:"companies_by_type"`
CompaniesByIndustry map[string]int64 `json:"companies_by_industry"`
CompaniesByStatus map[string]int64 `json:"companies_by_status"`
TopCategories []CategoryCount `json:"top_categories"`
TopCPVCodes []CPVCodeCount `json:"top_cpv_codes"`
TotalCompanies int64 `json:"total_companies"`
ActiveCompanies int64 `json:"active_companies"`
VerifiedCompanies int64 `json:"verified_companies"`
CompaniesByType map[string]int64 `json:"companies_by_type"`
CompaniesByIndustry map[string]int64 `json:"companies_by_industry"`
CompaniesByStatus map[string]int64 `json:"companies_by_status"`
TopCategories []CategoryCount `json:"top_categories"`
TopCPVCodes []CPVCodeCount `json:"top_cpv_codes"`
}
type CategoryCount struct {