added AI auto-generated keywords to customer profile
This commit is contained in:
+27
-14
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user