added AI auto-generated keywords to customer profile

This commit is contained in:
Mazyar
2026-01-04 13:44:45 +03:30
parent 3381e04e05
commit 8dcda0e031
9 changed files with 435 additions and 48 deletions
+27 -14
View File
@@ -28,6 +28,7 @@ type UpdateCustomerForm struct {
Username string `json:"username" valid:"required,username,length(3|30)" example:"user"`
Email string `json:"email" valid:"required,email" example:"user@opplens.com"`
Phone *string `json:"phone,omitempty" valid:"optional,length(10|20)" example:"+1234567890"`
Keywords []string `json:"keywords,omitempty" valid:"optional"`
}
// CustomerStatusForm represents the form for suspending a customer
@@ -63,25 +64,37 @@ type CustomerResponse struct {
UpdatedAt int64 `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
LastLoginAt *int64 `json:"last_login_at"`
Companies []*CompanySummary `json:"companies"`
DeviceToken []string `json:"-"`
Companies []*CompanySummary `json:"companies"`
Keywords []string `json:"keywords"`
KeywordsStatus string `json:"keywords_status"`
DeviceToken []string `json:"-"`
}
// ToResponse converts Customer to CustomerResponse
func (c *Customer) ToResponse(companies []*CompanySummary) *CustomerResponse {
keywords := c.Keywords
if keywords == nil {
keywords = []string{}
}
keywordsStatus := string(c.KeywordsStatus)
if keywordsStatus == "" {
keywordsStatus = string(KeywordsStatusReady)
}
return &CustomerResponse{
ID: c.ID.Hex(),
FullName: c.FullName,
Username: c.Username,
Email: c.Email,
Type: string(c.Type),
Status: string(c.Status),
Role: string(c.Role),
Phone: c.Phone,
UpdatedAt: c.UpdatedAt,
CreatedAt: c.CreatedAt,
LastLoginAt: c.LastLoginAt,
Companies: companies,
ID: c.ID.Hex(),
FullName: c.FullName,
Username: c.Username,
Email: c.Email,
Type: string(c.Type),
Status: string(c.Status),
Role: string(c.Role),
Phone: c.Phone,
UpdatedAt: c.UpdatedAt,
CreatedAt: c.CreatedAt,
LastLoginAt: c.LastLoginAt,
Companies: companies,
Keywords: keywords,
KeywordsStatus: keywordsStatus,
}
}