feat: recurring expenses and reports
This commit is contained in:
parent
cda4f61939
commit
9e6ff67a87
23 changed files with 2943 additions and 56 deletions
42
internal/model/budget.go
Normal file
42
internal/model/budget.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type BudgetPeriod string
|
||||
|
||||
const (
|
||||
BudgetPeriodWeekly BudgetPeriod = "weekly"
|
||||
BudgetPeriodMonthly BudgetPeriod = "monthly"
|
||||
BudgetPeriodYearly BudgetPeriod = "yearly"
|
||||
)
|
||||
|
||||
type BudgetStatus string
|
||||
|
||||
const (
|
||||
BudgetStatusOnTrack BudgetStatus = "on_track"
|
||||
BudgetStatusWarning BudgetStatus = "warning"
|
||||
BudgetStatusOver BudgetStatus = "over"
|
||||
)
|
||||
|
||||
type Budget struct {
|
||||
ID string `db:"id"`
|
||||
SpaceID string `db:"space_id"`
|
||||
TagID string `db:"tag_id"`
|
||||
AmountCents int `db:"amount_cents"`
|
||||
Period BudgetPeriod `db:"period"`
|
||||
StartDate time.Time `db:"start_date"`
|
||||
EndDate *time.Time `db:"end_date"`
|
||||
IsActive bool `db:"is_active"`
|
||||
CreatedBy string `db:"created_by"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
|
||||
type BudgetWithSpent struct {
|
||||
Budget
|
||||
TagName string `db:"tag_name"`
|
||||
TagColor *string `db:"tag_color"`
|
||||
SpentCents int
|
||||
Percentage float64
|
||||
Status BudgetStatus
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue