user

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package user manages user accounts and profile data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles user HTTP requests.

func NewHandler

func NewHandler(userSvc *Service, logger *slog.Logger) *Handler

NewHandler creates a new user handler.

func (*Handler) Me

func (h *Handler) Me(w http.ResponseWriter, r *http.Request)

Me handles requests for the current user's info.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository provides data access for the user domain.

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

NewRepository creates a new user repository.

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, userID string) (*User, error)

GetByID retrieves a user by ID.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides user business logic.

func NewService

func NewService(repo *Repository) *Service

NewService creates a new user service.

func (*Service) GetMe

func (s *Service) GetMe(ctx context.Context, userID string) (*User, error)

GetMe retrieves the current user by ID.

type User

type User struct {
	ID             string             `db:"id"`
	Email          string             `db:"email"`
	IsAdmin        bool               `db:"is_admin"`
	AccountStatus  core.AccountStatus `db:"account_status"`
	TrialStartedAt *int64             `db:"trial_started_at"`
	CreatedAt      int64              `db:"created_at"`
	UpdatedAt      int64              `db:"updated_at"`
}

type UserResponse

type UserResponse struct {
	ID             string             `json:"id"`
	Email          string             `json:"email"`
	IsAdmin        bool               `json:"is_admin"`
	AccountStatus  core.AccountStatus `json:"account_status"`
	TrialStartedAt *time.Time         `json:"trial_started_at,omitempty"`
	CreatedAt      time.Time          `json:"created_at"`
	UpdatedAt      time.Time          `json:"updated_at"`
}

func ToUserResponse

func ToUserResponse(u *User) UserResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL