mirror of
https://git.boos.lat/aibo/BossChat.git
synced 2026-10-30 15:16:11 +00:00
0f40930a41
- Rename Go module: cs-agent → bosschat - Rename all import paths across 200+ Go files - Rename SDK: cs-ai-agent-sdk → bosschat-sdk - Rename message protocol: cs-agent:* → bosschat:* - Rename JS globals: CSAgentConfig → BossChatConfig - Rename CSS classes: cs-agent-* → bosschat-* - Update Makefile APP_NAME and ARCHIVE_NAME - Update logo assets - Fix display name: BoosChat → BossChat
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package builders
|
|
|
|
import (
|
|
"bosschat/internal/models"
|
|
"bosschat/internal/pkg/dto/response"
|
|
"bosschat/internal/pkg/utils"
|
|
"bosschat/internal/services"
|
|
"time"
|
|
)
|
|
|
|
func BuildCustomer(item *models.Customer) *response.CustomerResponse {
|
|
if item == nil {
|
|
return nil
|
|
}
|
|
return &response.CustomerResponse{
|
|
ID: item.ID,
|
|
Name: item.Name,
|
|
Gender: item.Gender,
|
|
CompanyID: item.CompanyID,
|
|
Company: BuildCompany(services.CompanyService.Get(item.CompanyID)),
|
|
LastActiveAt: utils.FormatTimePtr(item.LastActiveAt),
|
|
PrimaryMobile: item.PrimaryMobile,
|
|
PrimaryEmail: item.PrimaryEmail,
|
|
Status: item.Status,
|
|
Remark: item.Remark,
|
|
CreatedAt: item.CreatedAt.Format(time.DateTime),
|
|
UpdatedAt: item.UpdatedAt.Format(time.DateTime),
|
|
}
|
|
}
|
|
|
|
func BuildCustomerList(list []models.Customer) []response.CustomerResponse {
|
|
results := make([]response.CustomerResponse, 0, len(list))
|
|
for _, item := range list {
|
|
if customer := BuildCustomer(&item); customer != nil {
|
|
results = append(results, *customer)
|
|
}
|
|
}
|
|
return results
|
|
}
|