handler

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package handler provides HTTP handlers for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountHandler added in v1.2.0

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

AccountHandler handles account-related HTTP requests.

func NewAccountHandler added in v1.2.0

func NewAccountHandler(service domain.AccountService) *AccountHandler

NewAccountHandler creates a new AccountHandler.

func (*AccountHandler) Create added in v1.2.0

func (h *AccountHandler) Create(w http.ResponseWriter, r *http.Request)

Create handles POST /v1/accounts

func (*AccountHandler) Delete added in v1.2.0

func (h *AccountHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete handles DELETE /v1/accounts/{id}

func (*AccountHandler) GetByID added in v1.2.0

func (h *AccountHandler) GetByID(w http.ResponseWriter, r *http.Request)

GetByID handles GET /v1/accounts/{id}

func (*AccountHandler) List added in v1.2.0

List handles GET /v1/accounts

func (*AccountHandler) Update added in v1.2.0

func (h *AccountHandler) Update(w http.ResponseWriter, r *http.Request)

Update handles PATCH /v1/accounts/{id}

type AuthHandler

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

AuthHandler handles authentication-related HTTP requests.

func NewAuthHandler

func NewAuthHandler(service domain.AuthService) *AuthHandler

NewAuthHandler creates a new AuthHandler with the given service and logger.

func (*AuthHandler) RefreshToken

func (h *AuthHandler) RefreshToken(w http.ResponseWriter, r *http.Request)

RefreshToken handles POST /v1/auth/token/refresh

func (*AuthHandler) RequestOTP

func (h *AuthHandler) RequestOTP(w http.ResponseWriter, r *http.Request)

RequestOTP handles POST /v1/auth/otp/request

func (*AuthHandler) VerifyOTP

func (h *AuthHandler) VerifyOTP(w http.ResponseWriter, r *http.Request)

VerifyOTP handles POST /v1/auth/otp/verify

type CategoryHandler added in v1.3.0

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

func NewCategoryHandler added in v1.3.0

func NewCategoryHandler(service domain.CategoryService) *CategoryHandler

func (*CategoryHandler) Create added in v1.3.0

func (h *CategoryHandler) Create(w http.ResponseWriter, r *http.Request)

Create handles POST /v1/categories

func (*CategoryHandler) Delete added in v1.3.0

func (h *CategoryHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete handles DELETE /v1/categories/{id}

func (*CategoryHandler) GetByID added in v1.3.0

func (h *CategoryHandler) GetByID(w http.ResponseWriter, r *http.Request)

GetByID handles GET /v1/categories/{id}

func (*CategoryHandler) List added in v1.3.0

List handles GET /v1/categories

func (*CategoryHandler) Update added in v1.3.0

func (h *CategoryHandler) Update(w http.ResponseWriter, r *http.Request)

Update handles PATCH /v1/categories/{id}

type CreateAccountRequest added in v1.2.0

type CreateAccountRequest struct {
	Name         string             `json:"name"          validate:"required,min=1,max=100"`
	Type         domain.AccountType `json:"type"          validate:"required,oneof=checking savings credit_card investment"`
	Currency     string             `json:"currency"      validate:"required,len=3"`
	InitialCents int64              `json:"initial_cents" validate:"required"`
}

CreateAccountRequest defines the payload for creating a new account.

type CreateCategoryRequest added in v1.3.0

type CreateCategoryRequest struct {
	ParentID *string             `json:"parent_id" validate:"omitempty"`
	Icon     *string             `json:"icon"      validate:"omitempty"`
	Color    *string             `json:"color"     validate:"omitempty"`
	Name     string              `json:"name"      validate:"required,min=1,max=100"`
	Type     domain.CategoryType `json:"type"      validate:"required"`
}

type InviteUserRequest added in v1.1.0

type InviteUserRequest struct {
	Email string      `json:"email" validate:"required,email"`
	Role  domain.Role `json:"role"  validate:"required,oneof=owner member"`
}

InviteUserRequest defines the payload for inviting a user.

type RequestOTPRequest

type RequestOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
}

RequestOTPRequest defines the payload for requesting an OTP.

type TenantHandler added in v1.1.0

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

TenantHandler handles tenant-related HTTP requests.

func NewTenantHandler added in v1.1.0

func NewTenantHandler(service domain.TenantService) *TenantHandler

NewTenantHandler creates a new TenantHandler.

func (*TenantHandler) GetMe added in v1.1.0

func (h *TenantHandler) GetMe(w http.ResponseWriter, r *http.Request)

GetMe handles GET /v1/tenants/me

func (*TenantHandler) InviteUser added in v1.1.0

func (h *TenantHandler) InviteUser(w http.ResponseWriter, r *http.Request)

InviteUser handles POST /v1/tenants/me/invite

func (*TenantHandler) UpdateMe added in v1.1.0

func (h *TenantHandler) UpdateMe(w http.ResponseWriter, r *http.Request)

UpdateMe handles PATCH /v1/tenants/me

type TokenResponse

type TokenResponse struct {
	// ExpiresAt is the timestamp when the access token expires.
	ExpiresAt time.Time `json:"expires_at"`
	// AccessToken is the PASETO access token.
	//
	//nolint:gosec
	AccessToken string `json:"access_token"`
	// RefreshToken is the PASETO refresh token.
	//
	//nolint:gosec
	RefreshToken string `json:"refresh_token"`
}

TokenResponse defines the successful authentication response.

type UpdateAccountRequest added in v1.2.0

type UpdateAccountRequest struct {
	Name     *string `json:"name"     validate:"omitempty,min=1,max=100"`
	Currency *string `json:"currency" validate:"omitempty,len=3"`
}

UpdateAccountRequest defines the payload for updating an account.

type UpdateCategoryRequest added in v1.3.0

type UpdateCategoryRequest struct {
	Name  *string `json:"name"  validate:"omitempty,min=1,max=100"`
	Icon  *string `json:"icon"  validate:"omitempty"`
	Color *string `json:"color" validate:"omitempty"`
}

type UpdateTenantRequest added in v1.1.0

type UpdateTenantRequest struct {
	Name *string `json:"name" validate:"omitempty,min=2,max=100"`
}

UpdateTenantRequest defines the payload for updating a tenant.

type VerifyOTPRequest

type VerifyOTPRequest struct {
	Email string `json:"email" validate:"required,email"`
	Code  string `json:"code"  validate:"required,len=6"`
}

VerifyOTPRequest defines the payload for verifying an OTP.

Jump to

Keyboard shortcuts

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