Enhance Customer Service with Notification Response Structures
- Introduced CustomerNotificationResponse struct to provide a detailed response format for customer notifications, improving the clarity of notification data. - Updated the Customer service interface to include methods for searching and retrieving customers with notification-specific responses, enhancing the flexibility of customer data retrieval. - Modified the Login method to accept a device token, allowing for better tracking of customer devices during login. - Refactored existing methods to utilize the new notification response structure, ensuring consistency across customer-related API responses. - Enhanced error handling and logging in the service layer for improved traceability during customer searches and logins.
This commit is contained in:
@@ -80,6 +80,30 @@ func (c *Customer) ToResponse(companies []*CompanySummary) *CustomerResponse {
|
||||
}
|
||||
}
|
||||
|
||||
type CustomerNotificationResponse struct {
|
||||
ID string `json:"id"`
|
||||
FullName *string `json:"full_name"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Type string `json:"type"`
|
||||
Role string `json:"role"`
|
||||
Phone *string `json:"phone"`
|
||||
DeviceToken []string `json:"device_token"`
|
||||
}
|
||||
|
||||
func (c *Customer) ToNotificationResponse() *CustomerNotificationResponse {
|
||||
return &CustomerNotificationResponse{
|
||||
ID: c.ID.Hex(),
|
||||
FullName: c.FullName,
|
||||
Username: c.Username,
|
||||
Email: c.Email,
|
||||
Type: string(c.Type),
|
||||
Role: string(c.Role),
|
||||
Phone: c.Phone,
|
||||
DeviceToken: c.DeviceToken,
|
||||
}
|
||||
}
|
||||
|
||||
// CustomerListResponse represents the response for listing customers
|
||||
type CustomerListResponse struct {
|
||||
Customers []*CustomerResponse `json:"customers"`
|
||||
|
||||
Reference in New Issue
Block a user