9119e2383e
- Introduced a new `config.yaml` file for managing server, database, cache, queue, AI, scraping, logging, and rate limiting configurations. - Updated `docker-compose.yml` to reflect the new server port (8081) and adjusted health check endpoints accordingly. - Modified `Dockerfile` to expose the new server port. - Updated `README.md` to reflect changes in server configuration and added documentation for the new configuration structure. - Added test scripts for server and Swagger documentation testing. - Refactored customer domain structure to align with new configuration settings and improve maintainability.
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package customer
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CustomerAggregate struct {
|
|
ID uuid.UUID `json:"_id"`
|
|
FullName string `json:"full_name"`
|
|
Username string `json:"username"`
|
|
Mobile string `json:"mobile"`
|
|
Email string `json:"email"`
|
|
Status string `json:"status"`
|
|
IsVerified bool `json:"is_verified"`
|
|
LastLoginAt *int64 `json:"last_login_at,omitempty"` // Unix timestamp
|
|
CreatedAt int64 `json:"created_at"` // Unix timestamp
|
|
UpdatedAt int64 `json:"updated_at"` // Unix timestamp
|
|
}
|
|
|
|
func NewCustomerAggregate(c Customer) CustomerAggregate {
|
|
customer := CustomerAggregate{
|
|
ID: c.ID,
|
|
FullName: c.FullName,
|
|
Username: c.Username,
|
|
Email: c.Email,
|
|
Mobile: c.Mobile,
|
|
Status: string(c.Status),
|
|
IsVerified: c.IsVerified,
|
|
CreatedAt: c.CreatedAt,
|
|
UpdatedAt: c.UpdatedAt,
|
|
}
|
|
if c.LastLoginAt != nil {
|
|
customer.LastLoginAt = c.LastLoginAt
|
|
}
|
|
|
|
return customer
|
|
}
|
|
|
|
// AuthResponse defines authentication response (kept for backward compatibility)
|
|
type AuthorizationResponse struct {
|
|
Customer CustomerAggregate `json:"customer"`
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
ExpiresIn int64 `json:"expires_in"`
|
|
}
|