74 lines
2.2 KiB
Go
74 lines
2.2 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// User represents a user in the system
|
|
type User struct {
|
|
ID uuid.UUID `json:"id" db:"id"`
|
|
TenantID *uuid.UUID `json:"tenant_id,omitempty" db:"tenant_id"`
|
|
Email string `json:"email" db:"email"`
|
|
Password string `json:"-" db:"password_hash"`
|
|
Name string `json:"name" db:"first_name"`
|
|
Role string `json:"role" db:"role"` // SUPERADMIN, ADMIN_AGENCIA, CLIENTE
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// CreateUserRequest represents the request to create a new user
|
|
type CreateUserRequest struct {
|
|
Email string `json:"email"`
|
|
Password string `json:"password"`
|
|
Name string `json:"name"`
|
|
Role string `json:"role,omitempty"` // Optional, defaults to CLIENTE
|
|
}
|
|
|
|
// RegisterAgencyRequest represents agency registration (SUPERADMIN only)
|
|
type RegisterAgencyRequest struct {
|
|
// Agência
|
|
AgencyName string `json:"agencyName"`
|
|
Subdomain string `json:"subdomain"`
|
|
CNPJ string `json:"cnpj"`
|
|
RazaoSocial string `json:"razaoSocial"`
|
|
Description string `json:"description"`
|
|
Website string `json:"website"`
|
|
Industry string `json:"industry"`
|
|
|
|
// Endereço
|
|
CEP string `json:"cep"`
|
|
State string `json:"state"`
|
|
City string `json:"city"`
|
|
Neighborhood string `json:"neighborhood"`
|
|
Street string `json:"street"`
|
|
Number string `json:"number"`
|
|
Complement string `json:"complement"`
|
|
|
|
// Admin da Agência
|
|
AdminEmail string `json:"adminEmail"`
|
|
AdminPassword string `json:"adminPassword"`
|
|
AdminName string `json:"adminName"`
|
|
}
|
|
|
|
// RegisterClientRequest represents client registration (ADMIN_AGENCIA only)
|
|
type RegisterClientRequest struct {
|
|
Email string `json:"email"`
|
|
Password string `json:"password"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// LoginRequest represents the login request
|
|
type LoginRequest struct {
|
|
Email string `json:"email"`
|
|
Password string `json:"password"`
|
|
}
|
|
|
|
// LoginResponse represents the login response
|
|
type LoginResponse struct {
|
|
Token string `json:"token"`
|
|
User User `json:"user"`
|
|
Subdomain *string `json:"subdomain,omitempty"`
|
|
}
|