budgit/internal/model/recurring_expense.go

46 lines
1.3 KiB
Go

package model
import (
"time"
"github.com/shopspring/decimal"
)
type Frequency string
const (
FrequencyDaily Frequency = "daily"
FrequencyWeekly Frequency = "weekly"
FrequencyBiweekly Frequency = "biweekly"
FrequencyMonthly Frequency = "monthly"
FrequencyYearly Frequency = "yearly"
)
type RecurringExpense struct {
ID string `db:"id"`
SpaceID string `db:"space_id"`
CreatedBy string `db:"created_by"`
Description string `db:"description"`
Amount decimal.Decimal `db:"amount"`
AmountCents int `db:"amount_cents"` // deprecated: kept for SELECT * compatibility
Type ExpenseType `db:"type"`
PaymentMethodID *string `db:"payment_method_id"`
Frequency Frequency `db:"frequency"`
StartDate time.Time `db:"start_date"`
EndDate *time.Time `db:"end_date"`
NextOccurrence time.Time `db:"next_occurrence"`
IsActive bool `db:"is_active"`
CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"`
}
type RecurringExpenseWithTags struct {
RecurringExpense
Tags []*Tag
}
type RecurringExpenseWithTagsAndMethod struct {
RecurringExpense
Tags []*Tag
PaymentMethod *PaymentMethod
}