api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ColorGreen string = "#198754"
View Source
const ColorRed string = "#dc3545"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountController

type AccountController struct {
	AccountManager        *services.AccountManager
	AccountRepository     *models.AccountRepository
	AccountTypeRepository *models.AccountTypeRepository
	BalanceRepository     *models.BalanceRepository
	TransactionRepository *models.TransactionRepository
}

type AccountDTO

type AccountDTO struct {
	ID                 uint
	Name               string
	AccountCategory    string
	AccountType        string
	DefaultParser      *string
	Balance            string
	BalanceLastUpdated string
	TxnLastUpdated     string
}

type AccountFormDTO

type AccountFormDTO struct {
	ActivePage string // This is used to highlight the active page in the navigation

	// If we're updating an existing account in the form, Updating will be true
	// If we're creating a new account, Updating will be false
	Updating        bool
	AccountID       string
	AccountName     string
	AccountTypeName string
	AccountTypes    []models.AccountType // the DTO probably shouldn't be using the models
	DefaultParser   string
}

type AccountsPageDTO

type AccountsPageDTO struct {
	ActivePage            string
	Accounts              []AccountDTO
	AccountUpdated        bool
	AccountUpdatedMessage string
}

type ApiServer

type ApiServer struct {
	AccountController     *AccountController
	BalanceController     *BalanceController
	BudgetController      *BudgetController
	CategoryController    *CategoryController
	ImportController      *ImportController
	NetIncomeController   *NetIncomeController
	NetWorthController    *NetWorthController
	SpendingController    *SpendingController
	TransactionController *TransactionController
	SettingsController    *SettingsController
	CashFlowController    *CashFlowReportHandler
}

func (*ApiServer) StartApiServer

func (as *ApiServer) StartApiServer(ctx context.Context)

type BalanceController

type BalanceController struct {
	AccountRepository *models.AccountRepository
	BalanceRepository *models.BalanceRepository
}

type BalanceDTO

type BalanceDTO struct {
	ID            uint
	UpdatedAt     string
	Date          string
	EffectiveDate string
	Amount        string
	AccountID     uint
	AccountName   string
}

type BalanceFormDTO

type BalanceFormDTO struct {
	ActivePage string // This is used to highlight the active page in the navigation
	// If we're editing an existing account, Editing will be true
	// If we're creating a new account, Editing will be false
	Editing bool
	// we set the AccountID for the to populate the balanceForm with the accountID
	// in HTML forms, so the account ID can be passed in the form submission even
	// if there is no Balance object set
	AccountID    uint
	BalanceDTO   BalanceDTO
	ErrorMessage string
}

type BalancesPageDTO

type BalancesPageDTO struct {
	ActivePage          string // This is used to highlight the active page in the navigation
	AccountID           uint
	Balances            []BalanceDTO
	BalanceSaved        bool
	BalanceSavedMessage string
}

type BudgetController

type BudgetController struct {
	BudgetRepository      *models.BudgetRepository
	BudgetService         *services.BudgetService
	CategoryRepository    *models.CategoryRepository
	TransactionRepository *models.TransactionRepository
}

type BudgetDTO

type BudgetDTO struct {
	ID           uint
	CategoryName string
	Amount       string
	Spend        string
	PercentUsed  int
}

type BudgetDataByMonthDTO

type BudgetDataByMonthDTO struct {
	Amount string
	Color  string
	Month  string
	Spend  string
}

type BudgetDetailDTO

type BudgetDetailDTO struct {
	ActivePage          string // This is used to highlight the active page in the navigation
	ID                  uint
	CategoryName        string
	NumOfMonthsExceeded string
	ExceededColor       string
	Average             string
	StdDev              string
	Volatility          string
	BudgetData          []BudgetDataByMonthDTO
}

type BudgetFormDTO

type BudgetFormDTO struct {
	ActivePage string // This is used to highlight the active page in the navigation
	// If we're updating an existing budget in the form, Updating will be true
	// If we're creating a new budget, Updating will be false
	Updating     bool
	BudgetID     string
	CategoryName string
	Amount       string
	Categories   []models.Category
}

type BudgetsPageDTO

type BudgetsPageDTO struct {
	ActivePage  string
	Budgets     []BudgetDTO
	BudgetSaved bool
}

type CashFlowDto added in v1.2.0

type CashFlowDto struct {
	ActivePage                 string
	NetIncome                  string
	NetIncomeHumanReadable     string
	NetIncomeLabel             string
	TotalIncome                string
	TotalIncomeHumanReadable   string
	TotalExpenses              string
	TotalExpensesHumanReadable string
	Expenses                   []ExpenseData
	StartDate                  string // YYYY-MM-DD for date input
	EndDate                    string // YYYY-MM-DD for date input
}

type CashFlowReportHandler added in v1.2.0

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

func NewCashFlowReportHandler added in v1.2.0

func NewCashFlowReportHandler(cfs *services.CashFlowService) *CashFlowReportHandler

func (*CashFlowReportHandler) ServeHTTP added in v1.2.0

type CategoriesPageDTO

type CategoriesPageDTO struct {
	ActivePage          string
	Categories          []CategoryDTO
	CategorySaved       bool
	CreatedCategoryName string
}

type CategoryController

type CategoryController struct {
	CategoryRepository *models.CategoryRepository
	BalanceRepository  *models.BalanceRepository
	BudgetRepository   *models.BudgetRepository
}

type CategoryDTO

type CategoryDTO struct {
	ID        uint
	Name      string
	HasBudget bool
}

type CategoryFormDTO

type CategoryFormDTO struct {
	ActivePage string // This is used to highlight the active page in the navigation
	// If we're updating an existing category in the form, Updating will be true
	// If we're creating a new category, Updating will be false
	Updating     bool
	CategoryID   string
	CategoryName string
}

type DashbaordController

type DashbaordController struct{}

type ExpenseData added in v1.2.0

type ExpenseData struct {
	Name                string
	Amount              string
	AmountHumanReadable string
}

type ImportController

type ImportController struct {
	AccountManager        *services.AccountManager
	ImportService         *services.ImportService
	TransactionRepository *models.TransactionRepository
}

type ImportStatementFormDTO

type ImportStatementFormDTO struct {
	ActivePage         string
	AccountNamesAndIDs []services.AccountNameAndID
}

type ImportStatusPageDTO

type ImportStatusPageDTO struct {
	ActivePage   string
	Submission   *models.ImportSubmission
	Transactions []TransactionDTO
}

type IncomeAndExpensesDTO

type IncomeAndExpensesDTO struct {
	ActivePage         string
	AllTimeActive      bool
	Last12MonthsActive bool
	Last6MonthsActive  bool
	Last3MonthsActive  bool
	DataSets           []IncomeAndExpensesDataSet
}

type IncomeAndExpensesDataSet

type IncomeAndExpensesDataSet struct {
	Date                      string
	Income                    string
	IncomeHumanized           string
	Expenses                  string
	ExpensesHumanized         string
	NetIncome                 string
	NetIncomeHumanized        string
	TTMAverage                string
	TTMSeventyFifthPercentile string
	TTMTwentyFifthPercentile  string
}

type NetIncomeController

type NetIncomeController struct {
	TransactionRepository *models.TransactionRepository
}

type NetWorthController

type NetWorthController struct {
	BalanceRepository *models.BalanceRepository
}

type SettingsController added in v1.1.0

type SettingsController struct {
	SettingsRepository *models.SettingsRepository
}

type SettingsPageDTO added in v1.1.0

type SettingsPageDTO struct {
	ActivePage string
	// List of settings to be displayed on the page
	LaunchBrowserOnStartup bool

	SettingsUpdated        bool
	SettingsUpdatedMessage string
}

type SpendingByCategoryDTO

type SpendingByCategoryDTO struct {
	ActivePage           string
	AllTimeActive        bool
	Last12MonthsActive   bool
	Last6MonthsActive    bool
	Last3MonthsActive    bool
	SpendingByCategories []spendingByCategory
}

type SpendingController

type SpendingController struct {
	TransactionRepository *models.TransactionRepository
}

type TransactionController

type TransactionController struct {
	AccountRepository     *models.AccountRepository
	CategoryRepository    *models.CategoryRepository
	TransactionRepository *models.TransactionRepository
}

type TransactionDTO

type TransactionDTO struct {
	ID                 uint
	Date               string
	Description        string
	Amount             string
	Excluded           bool
	AccountName        string
	CategoryName       string
	ImportSubmissionID string
}

type TransactionFormDTO

type TransactionFormDTO struct {
	ActivePage string // This is used to highlight the active page in the navigation
	// If we're editing an existing transaction, Editing will be true
	// If we're creating a new transaction, Editing will be false
	Editing            bool
	TransactionID      uint
	Date               string
	Description        string
	Amount             string
	Excluded           bool
	AccountName        string
	CategoryName       string
	ImportSubmissionID string
	Accounts           []models.Account
	Categories         []models.Category
}

type TransactionsPageDto

type TransactionsPageDto struct {
	ActivePage                string
	Transactions              []TransactionDTO
	TransactionUpdated        bool
	TransactionUpdatedMessage string
	Accounts                  []models.Account
	SelectedAccountID         uint
	Categories                []models.Category
	SelectedCategoryID        uint
	Description               string
	StartDate                 string
	EndDate                   string
}

Jump to

Keyboard shortcuts

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