handler

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 9 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

@Summary Create account @Description Creates a new financial account for the current tenant. @Tags accounts @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body CreateAccountRequest true "Account details" @Success 201 {object} domain.Account @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/accounts [post]

func (*AccountHandler) Delete added in v1.2.0

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

Delete handles DELETE /v1/accounts/{id}

@Summary Delete account @Description Soft-deletes an account and its transactions. @Tags accounts @Accept json @Produce json @Security BearerAuth @Param id path string true "Account ULID" @Success 204 "Account deleted" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Account not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/accounts/{id} [delete]

func (*AccountHandler) GetByID added in v1.2.0

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

GetByID handles GET /v1/accounts/{id}

@Summary Get account @Description Returns details of a specific account by ID. @Tags accounts @Accept json @Produce json @Security BearerAuth @Param id path string true "Account ULID" @Success 200 {object} domain.Account @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Account not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/accounts/{id} [get]

func (*AccountHandler) List added in v1.2.0

List handles GET /v1/accounts

@Summary List accounts @Description Returns all accounts belonging to the current tenant. @Tags accounts @Accept json @Produce json @Security BearerAuth @Success 200 {array} domain.Account @Failure 401 {object} map[string]string "Unauthorized" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/accounts [get]

func (*AccountHandler) Update added in v1.2.0

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

Update handles PATCH /v1/accounts/{id}

@Summary Update account @Description Updates details of an existing account. @Tags accounts @Accept json @Produce json @Security BearerAuth @Param id path string true "Account ULID" @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body UpdateAccountRequest true "Update fields" @Success 200 {object} domain.Account @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Account not found" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/accounts/{id} [patch]

type AdminHandler added in v1.5.0

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

func NewAdminHandler added in v1.5.0

func NewAdminHandler(service domain.AdminService) *AdminHandler

func (*AdminHandler) ForceDeleteUser added in v1.5.0

func (h *AdminHandler) ForceDeleteUser(w http.ResponseWriter, r *http.Request)

ForceDeleteUser DELETE /v1/admin/users/{id}

@Summary Force delete user @Description Permanently deletes a user from the system. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "User ULID" @Success 204 "User deleted permanently" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/users/{id} [delete]

func (*AdminHandler) GetTenant added in v1.5.0

func (h *AdminHandler) GetTenant(w http.ResponseWriter, r *http.Request)

GetTenant GET /v1/admin/tenants/{id}

@Summary Get tenant details @Description Returns details of any tenant by ID. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "Tenant ULID" @Success 200 {object} domain.Tenant @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 404 {object} map[string]string "Tenant not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/tenants/{id} [get]

func (*AdminHandler) GetUser added in v1.5.0

func (h *AdminHandler) GetUser(w http.ResponseWriter, r *http.Request)

GetUser GET /v1/admin/users/{id}

@Summary Get user details @Description Returns details of any user by ID. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "User ULID" @Success 200 {object} domain.User @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 404 {object} map[string]string "User not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/users/{id} [get]

func (*AdminHandler) HardDeleteTenant added in v1.5.0

func (h *AdminHandler) HardDeleteTenant(w http.ResponseWriter, r *http.Request)

HardDeleteTenant DELETE /v1/admin/tenants/{id}

@Summary Hard delete tenant @Description Permanently deletes a tenant and all its data. Requires sysadmin role and matching X-Confirm-Token header. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "Tenant ULID" @Param X-Confirm-Token header string true "Confirmation token (must match ID)" @Success 204 "Tenant deleted permanently" @Failure 400 {object} map[string]string "Invalid confirmation token" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/tenants/{id} [delete]

func (*AdminHandler) ListAuditLogs added in v1.5.0

func (h *AdminHandler) ListAuditLogs(w http.ResponseWriter, r *http.Request)

ListAuditLogs GET /v1/admin/audit-logs

@Summary List audit logs @Description Returns a paginated list of system audit logs. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param limit query int false "Limit (default 50)" @Param offset query int false "Offset (default 0)" @Success 200 {object} map[string]any @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/audit-logs [get]

func (*AdminHandler) ListTenants added in v1.5.0

func (h *AdminHandler) ListTenants(w http.ResponseWriter, r *http.Request)

ListTenants GET /v1/admin/tenants

@Summary List all tenants @Description Returns a list of all tenants in the system. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param with_deleted query bool false "Include soft-deleted tenants" @Success 200 {array} domain.Tenant @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/tenants [get]

func (*AdminHandler) ListUsers added in v1.5.0

func (h *AdminHandler) ListUsers(w http.ResponseWriter, r *http.Request)

ListUsers GET /v1/admin/users

@Summary List all users @Description Returns a list of all users in the system across all tenants. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Success 200 {array} domain.User @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/users [get]

func (*AdminHandler) RestoreTenant added in v1.5.0

func (h *AdminHandler) RestoreTenant(w http.ResponseWriter, r *http.Request)

RestoreTenant POST /v1/admin/tenants/{id}/restore

@Summary Restore tenant @Description Restores a suspended or soft-deleted tenant. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "Tenant ULID" @Success 204 "Tenant restored" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 404 {object} map[string]string "Tenant not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/tenants/{id}/restore [post]

func (*AdminHandler) SuspendTenant added in v1.5.0

func (h *AdminHandler) SuspendTenant(w http.ResponseWriter, r *http.Request)

SuspendTenant POST /v1/admin/tenants/{id}/suspend

@Summary Suspend tenant @Description Suspends a tenant's access to the system. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "Tenant ULID" @Success 204 "Tenant suspended" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 404 {object} map[string]string "Tenant not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/admin/tenants/{id}/suspend [post]

func (*AdminHandler) UpdateTenantPlan added in v1.5.0

func (h *AdminHandler) UpdateTenantPlan(w http.ResponseWriter, r *http.Request)

UpdateTenantPlan PATCH /v1/admin/tenants/{id}/plan

@Summary Update tenant plan @Description Changes the subscription plan of a tenant. Requires sysadmin role. @Tags admin @Accept json @Produce json @Security BearerAuth @Param id path string true "Tenant ULID" @Param request body UpdateTenantPlanRequest true "New plan details" @Success 200 {object} domain.Tenant @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string thin]string "Internal server error" @Router /v1/admin/tenants/{id}/plan [patch]

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

@Summary Refresh Token @Description Uses a valid refresh token to obtain a new access token. @Tags auth @Accept json @Produce json @Security BearerAuth @Success 200 {object} TokenResponse @Failure 401 {object} map[string]string "Invalid or expired refresh token" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/auth/token/refresh [post]

func (*AuthHandler) RequestOTP

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

RequestOTP handles POST /v1/auth/otp/request

@Summary Request OTP @Description Validates email and generates a 6-digit verification code sent via email. @Tags auth @Accept json @Produce json @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body RequestOTPRequest true "Email address" @Success 202 "OTP requested successfully (Accepted)" @Failure 400 {object} map[string]string "Invalid request body" @Failure 422 {object} map[string]string "Validation error" @Failure 429 {object} map[string]string "Rate limit exceeded" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/auth/otp/request [post]

func (*AuthHandler) VerifyOTP

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

VerifyOTP handles POST /v1/auth/otp/verify

@Summary Verify OTP @Description Validates the 6-digit code and returns a PASETO token pair. @Tags auth @Accept json @Produce json @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body VerifyOTPRequest true "Email and verification code" @Success 200 {object} TokenResponse @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Invalid or expired OTP" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/auth/otp/verify [post]

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

@Summary Create category @Description Creates a new category for the current tenant. @Tags categories @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body CreateCategoryRequest true "Category details" @Success 201 {object} domain.Category @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/categories [post]

func (*CategoryHandler) Delete added in v1.3.0

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

Delete handles DELETE /v1/categories/{id}

@Summary Delete category @Description Soft-deletes a category. This may be blocked if there are transactions associated with it. @Tags categories @Accept json @Produce json @Security BearerAuth @Param id path string true "Category ULID" @Success 204 "Category deleted" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Category not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/categories/{id} [delete]

func (*CategoryHandler) GetByID added in v1.3.0

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

GetByID handles GET /v1/categories/{id}

@Summary Get category @Description Returns details of a specific category by ID. @Tags categories @Accept json @Produce json @Security BearerAuth @Param id path string true "Category ULID" @Success 200 {object} domain.Category @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Category not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/categories/{id} [get]

func (*CategoryHandler) List added in v1.3.0

List handles GET /v1/categories

@Summary List categories @Description Returns all categories for the current tenant. Can be filtered by type or parent ID. @Tags categories @Accept json @Produce json @Security BearerAuth @Param type query string false "Category type (income/expense)" @Param parent_id query string false "Parent category ULID" @Success 200 {array} domain.Category @Failure 401 {object} map[string]string "Unauthorized" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/categories [get]

func (*CategoryHandler) Update added in v1.3.0

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

Update handles PATCH /v1/categories/{id}

@Summary Update category @Description Updates details of an existing category. @Tags categories @Accept json @Produce json @Security BearerAuth @Param id path string true "Category ULID" @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body UpdateCategoryRequest true "Update fields" @Success 200 {object} domain.Category @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Category not found" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/categories/{id} [patch]

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 CreateTransactionRequest added in v1.4.0

type CreateTransactionRequest struct {
	OccurredAt  time.Time              `json:"occurred_at"  validate:"required"`
	AccountID   string                 `json:"account_id"   validate:"required"`
	CategoryID  string                 `json:"category_id"  validate:"required"`
	Description string                 `json:"description"  validate:"required,min=1,max=255"`
	Type        domain.TransactionType `json:"type"         validate:"required,oneof=income expense transfer"`
	AmountCents int64                  `json:"amount_cents" validate:"required,gt=0"`
}

CreateTransactionRequest defines the incoming payload for creating a transaction.

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

@Summary Get current tenant @Description Returns the details of the tenant (household) associated with the authenticated user. @Tags tenants @Accept json @Produce json @Security BearerAuth @Success 200 {object} domain.Tenant @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Tenant not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/tenants/me [get]

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

@Summary Invite user @Description Invites a new user (family member) to the current tenant. @Tags tenants @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body InviteUserRequest true "Invite details" @Success 201 {object} domain.User @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 403 {object} map[string]string "Forbidden (admin only)" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/tenants/me/invite [post]

func (*TenantHandler) UpdateMe added in v1.1.0

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

UpdateMe handles PATCH /v1/tenants/me

@Summary Update current tenant @Description Updates the details of the current tenant (e.g., household name). @Tags tenants @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body UpdateTenantRequest true "Update fields" @Success 200 {object} domain.Tenant @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/tenants/me [patch]

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 TransactionHandler added in v1.4.0

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

TransactionHandler handles HTTP requests for transaction management.

func NewTransactionHandler added in v1.4.0

func NewTransactionHandler(service domain.TransactionService) *TransactionHandler

NewTransactionHandler creates a new TransactionHandler instance.

func (*TransactionHandler) Create added in v1.4.0

Create handles POST /v1/transactions

@Summary Create transaction @Description Creates a new financial transaction (income, expense, or transfer). @Tags transactions @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body CreateTransactionRequest true "Transaction details" @Success 201 {object} domain.Transaction @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/transactions [post]

func (*TransactionHandler) Delete added in v1.4.0

Delete handles DELETE /v1/transactions/{id}

@Summary Delete transaction @Description Soft-deletes a transaction. @Tags transactions @Accept json @Produce json @Security BearerAuth @Param id path string true "Transaction ULID" @Success 204 "Transaction deleted" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Transaction not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/transactions/{id} [delete]

func (*TransactionHandler) GetByID added in v1.4.0

GetByID handles GET /v1/transactions/{id}

@Summary Get transaction @Description Returns details of a specific transaction by ID. @Tags transactions @Accept json @Produce json @Security BearerAuth @Param id path string true "Transaction ULID" @Success 200 {object} domain.Transaction @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Transaction not found" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/transactions/{id} [get]

func (*TransactionHandler) List added in v1.4.0

List handles GET /v1/transactions

@Summary List transactions @Description Returns a list of transactions for the current tenant. Can be filtered by account, category, type, and date range. @Tags transactions @Accept json @Produce json @Security BearerAuth @Param account_id query string false "Account ULID" @Param category_id query string false "Category ULID" @Param type query string false "Transaction type (income/expense/transfer)" @Param start_date query string false "Start date (RFC3339)" @Param end_date query string false "End date (RFC3339)" @Param limit query int false "Limit (default 50)" @Param offset query int false "Offset (default 0)" @Success 200 {array} domain.Transaction @Failure 401 {object} map[string]string "Unauthorized" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/transactions [get]

func (*TransactionHandler) Update added in v1.4.0

Update handles PATCH /v1/transactions/{id}

@Summary Update transaction @Description Updates details of an existing transaction. @Tags transactions @Accept json @Produce json @Security BearerAuth @Param id path string true "Transaction ULID" @Param Idempotency-Key header string false "Optional idempotency key (ULID format recommended)" @Param request body UpdateTransactionRequest true "Update fields" @Success 200 {object} domain.Transaction @Failure 400 {object} map[string]string "Invalid request body" @Failure 401 {object} map[string]string "Unauthorized" @Failure 404 {object} map[string]string "Transaction not found" @Failure 422 {object} map[string]string "Validation error" @Failure 500 {object} map[string]string "Internal server error" @Router /v1/transactions/{id} [patch]

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 UpdateTenantPlanRequest added in v1.5.0

type UpdateTenantPlanRequest struct {
	Plan domain.TenantPlan `json:"plan" validate:"required,oneof=free pro business"`
}

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 UpdateTransactionRequest added in v1.4.0

type UpdateTransactionRequest struct {
	OccurredAt  *time.Time `json:"occurred_at"  validate:"omitempty"`
	CategoryID  *string    `json:"category_id"  validate:"omitempty"`
	Description *string    `json:"description"  validate:"omitempty,min=1,max=255"`
	AmountCents *int64     `json:"amount_cents" validate:"omitempty,gt=0"`
}

UpdateTransactionRequest defines the incoming payload for updating a transaction.

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