entities

package
v0.0.0-...-4d895cd Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorAccountExists   = errors.New("account already exists")
	ErrorAccountNotFound = errors.New("account not found")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID          uint64          `json:"id"`
	Name        string          `json:"name"`
	Description *string         `json:"description"`
	Type        AccountType     `json:"type"`
	Balance     currency.Amount `json:"amount"`

	DeletedAt *datetime.DateTime `json:"delete_at"`
	CreatedAt datetime.DateTime  `json:"created_at"`
	UpdateAt  datetime.DateTime  `json:"updated_at"`
}

type AccountType

type AccountType string
const (
	AccountTypeCash   AccountType = "cash"
	AccountTypeCredit AccountType = "credit"
	AccountTypeDebit  AccountType = "debit"
)

type Contact

type Contact struct {
	ID   uint64 `json:"id"`
	Name string `json:"name"`

	Text    string   `json:"text"`
	QRCodes []QRCode `json:"qr_code"`

	DeletedAt *datetime.DateTime `json:"delete_at"`
	CreatedAt datetime.DateTime  `json:"created_at"`
	UpdatedAt datetime.DateTime  `json:"updated_at"`
}

type Invoice

type Invoice struct {
	ID   uint64  `json:"id"`
	Name string  `json:"name"`
	Desc *string `json:"description"`

	Status InvoiceStatus `json:"status"`
	Type   InvoiceType   `json:"type"`

	Template     *InvoiceTemplate `json:"template"`
	Contact      *Contact         `json:"contact"`
	Transactions []Transaction    `json:"transactions"`

	Amount currency.Amount `json:"amount"`

	Date      datetime.DateTime `json:"date"`
	CreatedAt datetime.DateTime `json:"created_at"`
	UpdateAt  datetime.DateTime `json:"updated_at"`
}

type InvoiceStatus

type InvoiceStatus string
const (
	InvoiceStatusPending InvoiceStatus = "Pending"
	InvoiceStatusPaid    InvoiceStatus = "Paid"
)

type InvoiceTemplate

type InvoiceTemplate struct {
	ID   uint64  `json:"id"`
	Name string  `json:"name"`
	Desc *string `json:"description"`

	Type InvoiceType `json:"type"`

	Amount currency.Amount `json:"amount"`

	RepeatPlanner *RepeatPlanner `json:"repeat_planner"`

	ContactID uint64 `json:"contact_id"`

	Date      datetime.DateTime  `json:"date"`
	DeletedAt *datetime.DateTime `json:"delete_at"`
	CreatedAt datetime.DateTime  `json:"created_at"`
	UpdateAt  datetime.DateTime  `json:"updated_at"`
}

type InvoiceType

type InvoiceType string
const (
	InvoiceTypeIncome  InvoiceType = "Income"
	InvoiceTypeExpense InvoiceType = "Expense"
)

type Period

type Period struct {
	ID uint64 `json:"id"`

	SequenceOfYear uint8 `json:"sequence_of_year"`

	CreatedAt datetime.DateTime  `json:"created_at"`
	ClosedAt  *datetime.DateTime `json:"closed_at"`
}

func (*Period) Close

func (p *Period) Close()

type QRCode

type QRCode struct {
	BankName string `json:"bank_name"`
	Content  string `json:"content"`
}

type RepeatPlanner

type RepeatPlanner struct {
	IntervalCount uint32                     `json:"interval_count"`
	Interval      planner.PlanRepeatInterval `json:"interval"`
	DaysOfWeek    []time.Weekday             `json:"day_of_week"`
	EndDate       *datetime.Date             `json:"end_date"`
	EndCount      *uint32                    `json:"end_count"`
}

type Transaction

type Transaction struct {
	ID     uint64          `json:"id"`
	Amount currency.Amount `json:"amount"`

	From *Account `json:"from"`
	To   *Account `json:"to"`

	Invoice   *Invoice          `json:"invoice"`
	CreatedAt datetime.DateTime `json:"created_at"`
}

Jump to

Keyboard shortcuts

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