42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package response
|
|
|
|
import (
|
|
"enaklo-pos-be/internal/entity"
|
|
)
|
|
|
|
func MapToCustomerResponse(customer *entity.Customer) CustomerResponse {
|
|
if customer == nil {
|
|
return CustomerResponse{}
|
|
}
|
|
|
|
return CustomerResponse{
|
|
ID: customer.ID,
|
|
Name: customer.Name,
|
|
Email: customer.Email,
|
|
Phone: customer.Phone,
|
|
Points: customer.Points,
|
|
CustomerID: customer.CustomerID,
|
|
CreatedAt: customer.CreatedAt.Format("2006-01-02"),
|
|
BirthDate: customer.BirthDate.Format("2006-01-02"),
|
|
}
|
|
}
|
|
|
|
func MapToCustomerListResponse(customers *entity.MemberList) []CustomerResponse {
|
|
if customers == nil {
|
|
return []CustomerResponse{}
|
|
}
|
|
|
|
responseList := []CustomerResponse{}
|
|
for _, customer := range *customers {
|
|
responseList = append(responseList, MapToCustomerResponse(customer))
|
|
}
|
|
|
|
return responseList
|
|
}
|
|
|
|
type CustomerRegistrationResp struct {
|
|
EmailVerificationRequired bool `json:"email_verification_required"`
|
|
PhoneVerificationRequired bool `json:"phone_verification_required"`
|
|
VerificationID string `json:"verification_id"`
|
|
}
|