hako/internal/auth/domain/user.go

34 lines
607 B
Go

package domain
import (
"time"
"github.com/google/uuid"
)
// User represents a user in the domain
type User struct {
ID uuid.UUID
Email string
PasswordHash string
CreatedAt time.Time
UpdatedAt time.Time
}
// NewUser creates a new user with generated ID and timestamps
func NewUser(email, passwordHash string) *User {
now := time.Now()
return &User{
ID: uuid.New(),
Email: email,
PasswordHash: passwordHash,
CreatedAt: now,
UpdatedAt: now,
}
}
// Token represents a JWT token
type Token struct {
Token string
ExpiresAt time.Time
}