server

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: AGPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const DATE_FORMAT string = "02 Jan 2006"
View Source
const EXTENSION = ".paisa"

Variables

Functions

func Build added in v0.4.9

func Build(db *gorm.DB, enableCompression bool) *gin.Engine

func ClearPriceCache added in v0.6.0

func ClearPriceCache(db *gorm.DB) gin.H

func ClearPriceProviderCache added in v0.5.1

func ClearPriceProviderCache(db *gorm.DB, code string) gin.H

func DeleteBackups added in v0.3.2

func DeleteBackups(file LedgerFile) gin.H

func DeleteSheetBackups added in v0.6.3

func DeleteSheetBackups(file SheetFile) gin.H

func GetAccountGain added in v0.4.0

func GetAccountGain(db *gorm.DB, account string) gin.H

func GetAllocation

func GetAllocation(db *gorm.DB) gin.H

func GetBudget added in v0.4.8

func GetBudget(db *gorm.DB) gin.H

func GetCapitalGains added in v0.2.6

func GetCapitalGains(db *gorm.DB) gin.H

func GetCashFlow added in v0.4.2

func GetCashFlow(db *gorm.DB) gin.H

func GetCreditCard added in v0.6.5

func GetCreditCard(db *gorm.DB, account string) gin.H

func GetCreditCards added in v0.6.5

func GetCreditCards(db *gorm.DB) gin.H

func GetCurrentBudget added in v0.4.8

func GetCurrentBudget(db *gorm.DB) gin.H

func GetCurrentExpense added in v0.4.5

func GetCurrentExpense(db *gorm.DB) map[string][]posting.Posting

func GetCurrentNetworth added in v0.4.5

func GetCurrentNetworth(db *gorm.DB) gin.H

func GetDashboard added in v0.4.5

func GetDashboard(db *gorm.DB) gin.H

func GetDiagnosis added in v0.2.3

func GetDiagnosis(db *gorm.DB) gin.H

func GetExpense added in v0.2.0

func GetExpense(db *gorm.DB) gin.H

func GetFile added in v0.3.2

func GetFile(file LedgerFile) gin.H

func GetFiles added in v0.3.1

func GetFiles(db *gorm.DB) gin.H

func GetGain

func GetGain(db *gorm.DB) gin.H

func GetHarvest added in v0.2.2

func GetHarvest(db *gorm.DB) gin.H

func GetIncome added in v0.1.3

func GetIncome(db *gorm.DB) gin.H

func GetIncomeStatement added in v0.5.9

func GetIncomeStatement(db *gorm.DB) gin.H

func GetInvestment

func GetInvestment(db *gorm.DB) gin.H

func GetLatestTransactions added in v0.4.5

func GetLatestTransactions(db *gorm.DB) []transaction.Transaction

func GetLedger

func GetLedger(db *gorm.DB) gin.H

func GetLogs added in v0.5.1

func GetLogs() gin.H

func GetNetworth added in v0.4.5

func GetNetworth(db *gorm.DB) gin.H

func GetPortfolioAllocation added in v0.3.0

func GetPortfolioAllocation(db *gorm.DB) gin.H

func GetPriceAutoCompletions added in v0.5.1

func GetPriceAutoCompletions(db *gorm.DB, request AutoCompleteRequest) gin.H

func GetPriceProviders added in v0.5.1

func GetPriceProviders(db *gorm.DB) gin.H

func GetPrices added in v0.2.2

func GetPrices(db *gorm.DB) gin.H

func GetRecurringTransactions added in v0.4.3

func GetRecurringTransactions(db *gorm.DB) gin.H

func GetScheduleAL added in v0.2.5

func GetScheduleAL(db *gorm.DB) gin.H

func GetSheet added in v0.6.3

func GetSheet(file SheetFile) gin.H

func GetSheets added in v0.6.3

func GetSheets(db *gorm.DB) gin.H

func GetTransactions added in v0.2.9

func GetTransactions(db *gorm.DB) gin.H

func Listen

func Listen(db *gorm.DB, port int)

func Logger added in v0.5.1

func Logger(logger logrus.FieldLogger) gin.HandlerFunc

func SaveFile added in v0.3.1

func SaveFile(db *gorm.DB, file LedgerFile) gin.H

func SaveSheetFile added in v0.6.3

func SaveSheetFile(db *gorm.DB, file SheetFile) gin.H

func Sync added in v0.2.8

func Sync(db *gorm.DB, request SyncRequest) gin.H

func TokenAuthMiddleware added in v0.6.1

func TokenAuthMiddleware() gin.HandlerFunc

func ValidateFile added in v0.3.1

func ValidateFile(file LedgerFile) gin.H

Types

type AccountBudget added in v0.4.8

type AccountBudget struct {
	Account   string            `json:"account"`
	Forecast  decimal.Decimal   `json:"forecast"`
	Actual    decimal.Decimal   `json:"actual"`
	Rollover  decimal.Decimal   `json:"rollover"`
	Available decimal.Decimal   `json:"available"`
	Date      time.Time         `json:"date"`
	Expenses  []posting.Posting `json:"expenses"`
}

type AccountGain added in v0.4.0

type AccountGain struct {
	Account          string            `json:"account"`
	NetworthTimeline []Networth        `json:"networthTimeline"`
	XIRR             decimal.Decimal   `json:"xirr"`
	Postings         []posting.Posting `json:"postings"`
}

type Aggregate

type Aggregate struct {
	Date         time.Time       `json:"date"`
	Account      string          `json:"account"`
	MarketAmount decimal.Decimal `json:"market_amount"`
}

type AllocationTarget added in v0.1.3

type AllocationTarget struct {
	Name       string               `json:"name"`
	Target     decimal.Decimal      `json:"target"`
	Current    decimal.Decimal      `json:"current"`
	Aggregates map[string]Aggregate `json:"aggregates"`
}

type AllocationTargetConfig added in v0.1.3

type AllocationTargetConfig struct {
	Name     string
	Target   decimal.Decimal
	Accounts []string
}

type AutoCompleteRequest added in v0.5.1

type AutoCompleteRequest struct {
	Provider string            `json:"provider"`
	Field    string            `json:"field"`
	Filters  map[string]string `json:"filters"`
}

type Budget added in v0.4.8

type Budget struct {
	Date               time.Time       `json:"date"`
	Accounts           []AccountBudget `json:"accounts"`
	AvailableThisMonth decimal.Decimal `json:"availableThisMonth"`
	EndOfMonthBalance  decimal.Decimal `json:"endOfMonthBalance"`
	Forecast           decimal.Decimal `json:"forecast"`
}

type CapitalGain added in v0.2.2

type CapitalGain struct {
	Account     string                   `json:"account"`
	TaxCategory string                   `json:"tax_category"`
	FY          map[string]FYCapitalGain `json:"fy"`
}

type CashFlow added in v0.4.2

type CashFlow struct {
	Date        time.Time       `json:"date"`
	Income      decimal.Decimal `json:"income"`
	Expenses    decimal.Decimal `json:"expenses"`
	Liabilities decimal.Decimal `json:"liabilities"`
	Investment  decimal.Decimal `json:"investment"`
	Tax         decimal.Decimal `json:"tax"`
	Checking    decimal.Decimal `json:"checking"`
	Balance     decimal.Decimal `json:"balance"`
}

func GetCurrentCashFlow added in v0.4.5

func GetCurrentCashFlow(db *gorm.DB) []CashFlow

func (CashFlow) GroupDate added in v0.4.5

func (c CashFlow) GroupDate() time.Time

type CommodityBreakdown added in v0.3.0

type CommodityBreakdown struct {
	ParentCommodityID string          `json:"parent_commodity_id"`
	CommodityName     string          `json:"commodity_name"`
	SecurityName      string          `json:"security_name"`
	SecurityRating    string          `json:"security_rating"`
	SecurityIndustry  string          `json:"security_industry"`
	Percentage        decimal.Decimal `json:"percentage"`
	SecurityID        string          `json:"security_id"`
	SecurityType      string          `json:"security_type"`
	Amount            decimal.Decimal `json:"amount"`
}

type CreditCardBill added in v0.6.5

type CreditCardBill struct {
	StatementStartDate   time.Time       `json:"statementStartDate"`
	StatementEndDate     time.Time       `json:"statementEndDate"`
	DueDate              time.Time       `json:"dueDate"`
	PaidDate             *time.Time      `json:"paidDate"`
	Credits              decimal.Decimal `json:"credits"`
	Debits               decimal.Decimal `json:"debits"`
	DebitsRunningBalance decimal.Decimal
	OpeningBalance       decimal.Decimal           `json:"openingBalance"`
	ClosingBalance       decimal.Decimal           `json:"closingBalance"`
	Postings             []posting.Posting         `json:"postings"`
	Transactions         []transaction.Transaction `json:"transactions"`
}

type CreditCardSummary added in v0.6.5

type CreditCardSummary struct {
	Account        string                                `json:"account"`
	Network        string                                `json:"network"`
	Number         string                                `json:"number"`
	Balance        decimal.Decimal                       `json:"balance"`
	Bills          []CreditCardBill                      `json:"bills"`
	CreditLimit    decimal.Decimal                       `json:"creditLimit"`
	YearlySpends   map[string]map[string]decimal.Decimal `json:"yearlySpends"`
	ExpirationDate time.Time                             `json:"expirationDate"`
}

type FYCapitalGain added in v0.2.2

type FYCapitalGain struct {
	Units         decimal.Decimal `json:"units"`
	PurchasePrice decimal.Decimal `json:"purchase_price"`
	SellPrice     decimal.Decimal `json:"sell_price"`
	Tax           taxation.Tax    `json:"tax"`
	PostingPairs  []PostingPair   `json:"posting_pairs"`
}

type Gain

type Gain struct {
	Account  string            `json:"account"`
	Networth Networth          `json:"networth"`
	XIRR     decimal.Decimal   `json:"xirr"`
	Postings []posting.Posting `json:"postings"`
}

type Graph added in v0.3.2

type Graph struct {
	Nodes []Node `json:"nodes"`
	Links []Link `json:"links"`
}

type HarvestBreakdown added in v0.2.2

type HarvestBreakdown struct {
	Units             decimal.Decimal `json:"units"`
	PurchaseDate      time.Time       `json:"purchase_date"`
	PurchasePrice     decimal.Decimal `json:"purchase_price"`
	CurrentPrice      decimal.Decimal `json:"current_price"`
	PurchaseUnitPrice decimal.Decimal `json:"purchase_unit_price"`
	Tax               taxation.Tax    `json:"tax"`
}

type Harvestable added in v0.2.2

type Harvestable struct {
	Account               string             `json:"account"`
	TaxCategory           string             `json:"tax_category"`
	TotalUnits            decimal.Decimal    `json:"total_units"`
	HarvestableUnits      decimal.Decimal    `json:"harvestable_units"`
	UnrealizedGain        decimal.Decimal    `json:"unrealized_gain"`
	TaxableUnrealizedGain decimal.Decimal    `json:"taxable_unrealized_gain"`
	HarvestBreakdown      []HarvestBreakdown `json:"harvest_breakdown"`
	CurrentUnitPrice      decimal.Decimal    `json:"current_unit_price"`
	CurrentUnitDate       time.Time          `json:"current_unit_date"`
}

type Income added in v0.1.3

type Income struct {
	Date     time.Time         `json:"date"`
	Postings []posting.Posting `json:"postings"`
}

type IncomeStatement added in v0.5.9

type IncomeStatement struct {
	StartingBalance decimal.Decimal            `json:"startingBalance"`
	EndingBalance   decimal.Decimal            `json:"endingBalance"`
	Date            time.Time                  `json:"date"`
	Income          map[string]decimal.Decimal `json:"income"`
	Interest        map[string]decimal.Decimal `json:"interest"`
	Equity          map[string]decimal.Decimal `json:"equity"`
	Pnl             map[string]decimal.Decimal `json:"pnl"`
	Liabilities     map[string]decimal.Decimal `json:"liabilities"`
	Tax             map[string]decimal.Decimal `json:"tax"`
	Expenses        map[string]decimal.Decimal `json:"expenses"`
}

type IncomeYearlyCard added in v0.3.4

type IncomeYearlyCard struct {
	StartDate   time.Time         `json:"start_date"`
	EndDate     time.Time         `json:"end_date"`
	Postings    []posting.Posting `json:"postings"`
	GrossIncome decimal.Decimal   `json:"gross_income"`
	NetTax      decimal.Decimal   `json:"net_tax"`
	NetIncome   decimal.Decimal   `json:"net_income"`
}

type InvestmentYearlyCard added in v0.3.4

type InvestmentYearlyCard struct {
	StartDate         time.Time         `json:"start_date"`
	EndDate           time.Time         `json:"end_date"`
	Postings          []posting.Posting `json:"postings"`
	GrossSalaryIncome decimal.Decimal   `json:"gross_salary_income"`
	GrossOtherIncome  decimal.Decimal   `json:"gross_other_income"`
	NetTax            decimal.Decimal   `json:"net_tax"`
	NetIncome         decimal.Decimal   `json:"net_income"`
	NetInvestment     decimal.Decimal   `json:"net_investment"`
	NetExpense        decimal.Decimal   `json:"net_expense"`
	SavingsRate       decimal.Decimal   `json:"savings_rate"`
}

type Issue added in v0.2.3

type Issue struct {
	Level       Level  `json:"level"`
	Summary     string `json:"summary"`
	Description string `json:"description"`
	Details     string `json:"details"`
}

type LedgerFile added in v0.3.1

type LedgerFile struct {
	Name      string   `json:"name"`
	Content   string   `json:"content"`
	Versions  []string `json:"versions"`
	Operation string   `json:"operation"`
}

type Level added in v0.2.3

type Level string
const (
	WARN  Level = "warning"
	ERROR Level = "danger"
)
type Link struct {
	Source uint            `json:"source"`
	Target uint            `json:"target"`
	Value  decimal.Decimal `json:"value"`
}

type Networth added in v0.4.5

type Networth struct {
	Date                time.Time       `json:"date"`
	InvestmentAmount    decimal.Decimal `json:"investmentAmount"`
	WithdrawalAmount    decimal.Decimal `json:"withdrawalAmount"`
	GainAmount          decimal.Decimal `json:"gainAmount"`
	BalanceAmount       decimal.Decimal `json:"balanceAmount"`
	BalanceUnits        decimal.Decimal `json:"balanceUnits"`
	NetInvestmentAmount decimal.Decimal `json:"netInvestmentAmount"`
}

type Node added in v0.3.2

type Node struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type Pair added in v0.3.2

type Pair struct {
	Source uint `json:"source"`
	Target uint `json:"target"`
}

type PortfolioAggregate added in v0.3.0

type PortfolioAggregate struct {
	Group      string               `json:"group"`
	SubGroup   string               `json:"sub_group"`
	ID         string               `json:"id"`
	Percentage decimal.Decimal      `json:"percentage"`
	Amount     decimal.Decimal      `json:"amount"`
	Breakdowns []CommodityBreakdown `json:"breakdowns"`
}

type PortfolioAllocationGroups added in v0.4.0

type PortfolioAllocationGroups struct {
	Commomdities        []string             `json:"commodities"`
	NameAndSecurityType []PortfolioAggregate `json:"name_and_security_type"`
	SecurityType        []PortfolioAggregate `json:"security_type"`
	Rating              []PortfolioAggregate `json:"rating"`
	Industry            []PortfolioAggregate `json:"industry"`
}

func GetAccountPortfolioAllocation added in v0.4.0

func GetAccountPortfolioAllocation(db *gorm.DB, account string) PortfolioAllocationGroups

type PortfolioDimension added in v0.3.0

type PortfolioDimension struct {
	Group      string
	GroupFn    func(CommodityBreakdown) string
	SubGroup   string
	SubGroupFn func(CommodityBreakdown) string
	FilterFn   func(CommodityBreakdown, int) bool
}

type PostingPair added in v0.2.6

type PostingPair struct {
	Purchase posting.Posting `json:"purchase"`
	Sell     posting.Posting `json:"sell"`
	Tax      taxation.Tax    `json:"tax"`
}

type Rule added in v0.2.3

type Rule struct {
	Issue     Issue
	Predicate func(db *gorm.DB) []error
}

type RunningBalance added in v0.5.9

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

type ScheduleAL added in v0.3.4

type ScheduleAL struct {
	Entries []ScheduleALEntry `json:"entries"`
	Date    time.Time         `json:"date"`
}

type ScheduleALEntry added in v0.2.5

type ScheduleALEntry struct {
	Section ScheduleALSection `json:"section"`
	Amount  decimal.Decimal   `json:"amount"`
}

type ScheduleALSection added in v0.2.5

type ScheduleALSection struct {
	Code    string `json:"code"`
	Section string `json:"section"`
	Details string `json:"details"`
}

type SheetFile added in v0.6.3

type SheetFile struct {
	Name      string   `json:"name"`
	Content   string   `json:"content"`
	Versions  []string `json:"versions"`
	Operation string   `json:"operation"`
}

type SyncRequest added in v0.3.0

type SyncRequest struct {
	Journal    bool `json:"journal"`
	Prices     bool `json:"prices"`
	Portfolios bool `json:"portfolios"`
}

type Tax added in v0.1.3

type Tax struct {
	StartDate time.Time         `json:"start_date"`
	EndDate   time.Time         `json:"end_date"`
	Postings  []posting.Posting `json:"postings"`
}

type TransactionSequence added in v0.4.3

type TransactionSequence struct {
	Transactions []transaction.Transaction `json:"transactions"`
	Key          string                    `json:"key"`
	Period       string                    `json:"period"`
	Interval     int                       `json:"interval"`
}

func ComputeRecurringTransactions added in v0.4.5

func ComputeRecurringTransactions(postings []posting.Posting) []TransactionSequence

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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