Files
FlowReader/internal/domain/user.go

35 lines
851 B
Go

// Package domain contains business logic entities and interfaces.
package domain
import (
"time"
"github.com/google/uuid"
)
// User represents a registered user in the system.
type User struct {
ID uuid.UUID `json:"id"`
Email string `json:"email"`
PasswordHash string `json:"-"` // Never expose in JSON
IsAdmin bool `json:"is_admin"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Role string `json:"role"`
}
const (
RoleAdmin = "admin"
RoleUser = "user"
)
// UserRepository defines the interface for user persistence.ss.
type UserRepository interface {
Create(user *User) error
GetByEmail(email string) (*User, error)
GetByID(id uuid.UUID) (*User, error)
Exists(email string) (bool, error)
List() ([]*User, error)
Delete(id uuid.UUID) error
}