model package - github.com/kerti/balances/backend/model - Go Packages

model

package
v0.0.0-...-1f81106 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BankAccountColumnID represents the corresponding column in Bank Account table
	BankAccountColumnID filter.Field = "bank_accounts.entity_id"
	// BankAccountColumnAccountName represents the corresponding column in Bank Account table
	BankAccountColumnAccountName filter.Field = "bank_accounts.account_name"
	// BankAccountColumnBankName represents the corresponding column in Bank Account table
	BankAccountColumnBankName filter.Field = "bank_accounts.bank_name"
	// BankAccountColumnAccountHolderName represents the corresponding column in Bank Account table
	BankAccountColumnAccountHolderName filter.Field = "bank_accounts.account_holder_name"
	// BankAccountColumnAccountNumber represents the corresponding column in Bank Account table
	BankAccountColumnAccountNumber filter.Field = "bank_accounts.account_number"
	// BankAccountColumnLastBalance represents the corresponding column in Bank Account table
	BankAccountColumnLastBalance filter.Field = "bank_accounts.last_balance"
	// BankAccountColumnLastBalanceDate represents the corresponding column in Bank Account table
	BankAccountColumnLastBalanceDate filter.Field = "bank_accounts.last_balance_date"
	// BankAccountColumnStatus represents the corresponding column in Bank Account table
	BankAccountColumnStatus filter.Field = "bank_accounts.status"
	// BankAccountColumnCreated represents the corresponding column in Bank Account table
	BankAccountColumnCreated filter.Field = "bank_accounts.created"
	// BankAccountColumnCreatedBy represents the corresponding column in Bank Account table
	BankAccountColumnCreatedBy filter.Field = "bank_accounts.created_by"
	// BankAccountColumnUpdated represents the corresponding column in Bank Account table
	BankAccountColumnUpdated filter.Field = "bank_accounts.updated"
	// BankAccountColumnUpdatedBy represents the corresponding column in Bank Account table
	BankAccountColumnUpdatedBy filter.Field = "bank_accounts.updated_by"
	// BankAccountColumnDeleted represents the corresponding column in Bank Account table
	BankAccountColumnDeleted filter.Field = "bank_accounts.deleted"
	// BankAccountColumnDeletedBy represents the corresponding column in Bank Account table
	BankAccountColumnDeletedBy filter.Field = "bank_accounts.deleted_by"
)
View Source
const (
	// BankAccountBalanceColumnID represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnID filter.Field = "bank_account_balances.entity_id"
	// BankAccountBalanceColumnBankAccountID represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnBankAccountID filter.Field = "bank_account_balances.bank_account_entity_id"
	// BankAccountBalanceColumnDate represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDate filter.Field = "bank_account_balances.date"
	// BankAccountBalanceColumnBalance represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnBalance filter.Field = "bank_account_balances.balance"
	// BankAccountBalanceColumnCreated represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnCreated filter.Field = "bank_account_balances.created"
	// BankAccountBalanceColumnCreatedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnCreatedBy filter.Field = "bank_account_balances.created_by"
	// BankAccountBalanceColumnUpdated represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnUpdated filter.Field = "bank_account_balances.updated"
	// BankAccountBalanceColumnUpdatedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnUpdatedBy filter.Field = "bank_account_balances.updated_by"
	// BankAccountBalanceColumnDeleted represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDeleted filter.Field = "bank_account_balances.deleted"
	// BankAccountBalanceColumnDeletedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDeletedBy filter.Field = "bank_account_balances.deleted_by"
)
View Source
const (
	// PropertyColumnID represents the corresponding column in Property table
	PropertyColumnID filter.Field = "properties.entity_id"
	// PropertyColumnName represents the corresponding column in Property table
	PropertyColumnName filter.Field = "properties.name"
	// PropertyColumnAddress represents the corresponding column in Property table
	PropertyColumnAddress filter.Field = "properties.address"
	// PropertyColumnTotalArea represents the corresponding column in Property table
	PropertyColumnTotalArea filter.Field = "properties.total_area"
	// PropertyColumnBuildingArea represents the corresponding column in Property table
	PropertyColumnBuildingArea filter.Field = "properties.building_area"
	// PropertyColumnAreaUnit represents the corresponding column in Property table
	PropertyColumnAreaUnit filter.Field = "properties.area_unit"
	// PropertyColumnType represents the corresponding column in Property table
	PropertyColumnType filter.Field = "properties.type"
	// PropertyColumnTitleHolder represents the corresponding column in Property table
	PropertyColumnTitleHolder filter.Field = "properties.title_holder"
	// PropertyColumnTaxIdentifier represents the corresponding column in Property table
	PropertyColumnTaxIdentifier filter.Field = "properties.tax_identifier"
	// PropertyColumnPurchaseDate represents the corresponding column in Property table
	PropertyColumnPurchaseDate filter.Field = "properties.purchase_date"
	// PropertyColumnInitialValue represents the corresponding column in Property table
	PropertyColumnInitialValue filter.Field = "properties.initial_value"
	// PropertyColumnInitialValueDate represents the corresponding column in Property table
	PropertyColumnInitialValueDate filter.Field = "properties.initial_value_date"
	// PropertyColumnCurrentValue represents the corresponding column in Property table
	PropertyColumnCurrentValue filter.Field = "properties.current_value"
	// PropertyColumnCurrentvalueDate represents the corresponding column in Property table
	PropertyColumnCurrentvalueDate filter.Field = "properties.current_value_date"
	// PropertyColumnAnnualAppreciationPercent represents the corresponding column in Property table
	PropertyColumnAnnualAppreciationPercent filter.Field = "properties.annual_appreciation_percent"
	// PropertyColumnStatus represents the corresponding column in Property table
	PropertyColumnStatus filter.Field = "properties.status"
	// PropertyColumnCreated represents the corresponding column in Property table
	PropertyColumnCreated filter.Field = "properties.created"
	// PropertyColumnCreatedBy represents the corresponding column in Property table
	PropertyColumnCreatedBy filter.Field = "properties.created_by"
	// PropertyColumnUpdated represents the corresponding column in Property table
	PropertyColumnUpdated filter.Field = "properties.updated"
	// PropertyColumnUpdatedBy represents the corresponding column in Property table
	PropertyColumnUpdatedBy filter.Field = "properties.updated_by"
	// PropertyColumnDeleted represents the corresponding column in Property table
	PropertyColumnDeleted filter.Field = "properties.deleted"
	// PropertyColumnDeletedBy represents the corresponding column in Property table
	PropertyColumnDeletedBy filter.Field = "properties.deleted_by"
)
View Source
const (
	// PropertyValueColumnID represents the corresponding column in the Property Value table
	PropertyValueColumnID filter.Field = "property_values.entity_id"
	// PropertyValueColumnPropertyID represents the corresponding column in the Property Value table
	PropertyValueColumnPropertyID filter.Field = "property_values.property_entity_id"
	// PropertyValueColumnDate represents the corresponding column in the Property Value table
	PropertyValueColumnDate filter.Field = "property_values.date"
	// PropertyValueColumnValue represents the corresponding column in the Property Value table
	PropertyValueColumnValue filter.Field = "property_values.value"
	// PropertyValueColumnCreated represents the corresponding column in the Property Value table
	PropertyValueColumnCreated filter.Field = "property_values.created"
	// PropertyValueColumnCreatedBy represents the corresponding column in the Property Value table
	PropertyValueColumnCreatedBy filter.Field = "property_values.created_by"
	// PropertyValueColumnUpdated represents the corresponding column in the Property Value table
	PropertyValueColumnUpdated filter.Field = "property_values.updated"
	// PropertyValueColumnUpdatedBy represents the corresponding column in the Property Value table
	PropertyValueColumnUpdatedBy filter.Field = "property_values.updated_by"
	// PropertyValueColumnDeleted represents the corresponding column in the Property Value table
	PropertyValueColumnDeleted filter.Field = "property_values.deleted"
	// PropertyValueColumnDeletedBy represents the corresponding column in the Property Value table
	PropertyValueColumnDeletedBy filter.Field = "property_values.deleted_by"
)
View Source
const (
	// UserColumnID represents the corresponding column in User table
	UserColumnID filter.Field = "users.entity_id"
	// UserColumnUsername represents the corresponding column in User table
	UserColumnUsername filter.Field = "users.username"
	// UserColumnEmail represents the corresponding column in User table
	UserColumnEmail filter.Field = "users.email"
	// UserColumnPassword represents the corresponding column in User table
	UserColumnPassword filter.Field = "users.password"
	// UserColumnName represents the corresponding column in User table
	UserColumnName filter.Field = "users.name"
	// UserColumnCreated represents the corresponding column in User table
	UserColumnCreated filter.Field = "users.created"
	// UserColumnCreatedBy represents the corresponding column in User table
	UserColumnCreatedBy filter.Field = "users.created_by"
	// UserColumnUpdated represents the corresponding column in User table
	UserColumnUpdated filter.Field = "users.updated"
	// UserColumnUpdatedBy represents the corresponding column in User table
	UserColumnUpdatedBy filter.Field = "users.updated_by"
)
View Source
const (
	// VehicleColumnID represents the corresponding column in Vehicle table
	VehicleColumnID filter.Field = "vehicles.entity_id"
	// VehicleColumnName represents the corresponding column in Vehicle table
	VehicleColumnName filter.Field = "vehicles.name"
	// VehicleColumnMake represents the corresponding column in Vehicle table
	VehicleColumnMake filter.Field = "vehicles.make"
	// VehicleColumnModel represents the corresponding column in Vehicle table
	VehicleColumnModel filter.Field = "vehicles.model"
	// VehicleColumnYear represents the corresponding column in Vehicle table
	VehicleColumnYear filter.Field = "vehicles.year"
	// VehicleColumnType represents the corresponding column in Vehicle table
	VehicleColumnType filter.Field = "vehicles.type"
	// VehicleColumnTitleHolder represents the corresponding column in Vehicle table
	VehicleColumnTitleHolder filter.Field = "vehicles.title_holder"
	// VehicleColumnLicensePlateNumber represents the corresponding column in Vehicle table
	VehicleColumnLicensePlateNumber filter.Field = "vehicles.license_plate_number"
	// VehicleColumnPurchaseDate represents the corresponding column in Vehicle table
	VehicleColumnPurchaseDate filter.Field = "vehicles.purchase_date"
	// VehicleColumnInitialValue represents the corresponding column in Vehicle table
	VehicleColumnInitialValue filter.Field = "vehicles.initial_value"
	// VehicleColumnInitialValueDate represents the corresponding column in Vehicle table
	VehicleColumnInitialValueDate filter.Field = "vehicles.initial_value_date"
	// VehicleColumnCurrentValue represents the corresponding column in Vehicle table
	VehicleColumnCurrentValue filter.Field = "vehicles.current_value"
	// VehicleColumnCurrentvalueDate represents the corresponding column in Vehicle table
	VehicleColumnCurrentvalueDate filter.Field = "vehicles.current_value_date"
	// VehicleColumnAnnualDepreciationPercent represents the corresponding column in Vehicle table
	VehicleColumnAnnualDepreciationPercent filter.Field = "vehicles.annual_depreciation_percent"
	// VehicleColumnStatus represents the corresponding column in Vehicle table
	VehicleColumnStatus filter.Field = "vehicles.status"
	// VehicleColumnCreated represents the corresponding column in Vehicle table
	VehicleColumnCreated filter.Field = "vehicles.created"
	// VehicleColumnCreatedBy represents the corresponding column in Vehicle table
	VehicleColumnCreatedBy filter.Field = "vehicles.created_by"
	// VehicleColumnUpdated represents the corresponding column in Vehicle table
	VehicleColumnUpdated filter.Field = "vehicles.updated"
	// VehicleColumnUpdatedBy represents the corresponding column in Vehicle table
	VehicleColumnUpdatedBy filter.Field = "vehicles.updated_by"
	// VehicleColumnDeleted represents the corresponding column in Vehicle table
	VehicleColumnDeleted filter.Field = "vehicles.deleted"
	// VehicleColumnDeletedBy represents the corresponding column in Vehicle table
	VehicleColumnDeletedBy filter.Field = "vehicles.deleted_by"
)
View Source
const (
	// VehicleValueColumnID represents the corresponding column in the Vehicle Value table
	VehicleValueColumnID filter.Field = "vehicle_values.entity_id"
	// VehicleValueColumnVehicleID represents the corresponding column in the Vehicle Value table
	VehicleValueColumnVehicleID filter.Field = "vehicle_values.vehicle_entity_id"
	// VehicleValueColumnDate represents the corresponding column in the Vehicle Value table
	VehicleValueColumnDate filter.Field = "vehicle_values.date"
	// VehicleValueColumnValue represents the corresponding column in the Vehicle Value table
	VehicleValueColumnValue filter.Field = "vehicle_values.value"
	// VehicleValueColumnCreated represents the corresponding column in the Vehicle Value table
	VehicleValueColumnCreated filter.Field = "vehicle_values.created"
	// VehicleValueColumnCreatedBy represents the corresponding column in the Vehicle Value table
	VehicleValueColumnCreatedBy filter.Field = "vehicle_values.created_by"
	// VehicleValueColumnUpdated represents the corresponding column in the Vehicle Value table
	VehicleValueColumnUpdated filter.Field = "vehicle_values.updated"
	// VehicleValueColumnUpdatedBy represents the corresponding column in the Vehicle Value table
	VehicleValueColumnUpdatedBy filter.Field = "vehicle_values.updated_by"
	// VehicleValueColumnDeleted represents the corresponding column in the Vehicle Value table
	VehicleValueColumnDeleted filter.Field = "vehicle_values.deleted"
	// VehicleValueColumnDeletedBy represents the corresponding column in the Vehicle Value table
	VehicleValueColumnDeletedBy filter.Field = "vehicle_values.deleted_by"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationInfo

type AuthenticationInfo struct {
	Expiration *time.Time
	Token      *string
	User       *User
}

AuthenticationInfo is the wrapper object for authentication information

type BankAccount

type BankAccount struct {
	ID                uuid.UUID            `db:"entity_id" validate:"min=36,max=36"`
	AccountName       string               `db:"account_name" validate:"max=255"`
	BankName          string               `db:"bank_name" validate:"max=255"`
	AccountHolderName string               `db:"account_holder_name" validate:"max=255"`
	AccountNumber     string               `db:"account_number" validate:"max=255"`
	LastBalance       float64              `db:"last_balance" validate:"min=0"`
	LastBalanceDate   time.Time            `db:"last_balance_date"`
	Status            BankAccountStatus    `db:"status"`
	Created           time.Time            `db:"created"`
	CreatedBy         uuid.UUID            `db:"created_by" validate:"min=36,max=36"`
	Updated           null.Time            `db:"updated"`
	UpdatedBy         nuuid.NUUID          `db:"updated_by" validate:"min=36,max=36"`
	Deleted           null.Time            `db:"deleted"`
	DeletedBy         nuuid.NUUID          `db:"deleted_by" validate:"min=36,max=36"`
	Balances          []BankAccountBalance `db:"-"`
}

BankAccount represents a Bank Account object

func NewBankAccountFromInput

func NewBankAccountFromInput(input BankAccountInput, userID uuid.UUID) (b BankAccount)

NewBankAccountFromInput creates a new Bank Account from its input object

func (*BankAccount) AttachBalances

func (b *BankAccount) AttachBalances(balances []BankAccountBalance, clearBeforeAttach bool)

AttachBalances attaches Bank Account Balances to a Bank Account

func (*BankAccount) Delete

func (b *BankAccount) Delete(userID uuid.UUID) error

Delete performs a delete on a Bank Account

func (*BankAccount) SetNewBalance

func (b *BankAccount) SetNewBalance(input BankAccountBalanceInput, userID uuid.UUID) error

SetNewBalance sets a new balance and balance date on a Bank Account

func (*BankAccount) ToOutput

func (b *BankAccount) ToOutput() BankAccountOutput

ToOutput converts a Bank Account to its JSON-compatible object representation

func (*BankAccount) Update

func (b *BankAccount) Update(input BankAccountInput, userID uuid.UUID) error

Update performs an update on a Bank Account

type BankAccountBalance

type BankAccountBalance struct {
	ID            uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	BankAccountID uuid.UUID   `db:"bank_account_entity_id" validate:"min=36,max=36"`
	Date          time.Time   `db:"date"`
	Balance       float64     `db:"balance"`
	Created       time.Time   `db:"created"`
	CreatedBy     uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated       null.Time   `db:"updated"`
	UpdatedBy     nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
	Deleted       null.Time   `db:"deleted"`
	DeletedBy     nuuid.NUUID `db:"deleted_by" validate:"min=36,max=36"`
}

BankAccountBalance represents a snapshot of a Bank Account's balance at a given time

func NewBankAccountBalanceFromInput

func NewBankAccountBalanceFromInput(input BankAccountBalanceInput, bankAccountID uuid.UUID, userID uuid.UUID) (bb BankAccountBalance)

NewBankAccountBalanceFromInput creates a new Bank Account Balance from its input object

func (*BankAccountBalance) Delete

func (bb *BankAccountBalance) Delete(userID uuid.UUID) error

Delete performs a delete on a Bank Account Balance

func (*BankAccountBalance) ToOutput

ToOutput converts a Bank Account Balance to its JSON-compatible object representation

func (*BankAccountBalance) Update

func (bb *BankAccountBalance) Update(input BankAccountBalanceInput, userID uuid.UUID) error

Update performs an update on a Bank Account Balance

type BankAccountBalanceFilterInput

type BankAccountBalanceFilterInput struct {
	filter.BaseFilterInput
	BankAccountIDs *[]uuid.UUID         `json:"bankAccountIds,omitempty"`
	StartDate      cachetime.NCacheTime `json:"startDate,omitempty"`
	EndDate        cachetime.NCacheTime `json:"endDate,omitempty"`
	BalanceMin     *float64             `json:"balanceMin,omitempty"`
	BalanceMax     *float64             `json:"balanceMax,omitempty"`
}

BankAccountBalanceFilterInput is the filter input object for Bank Account Balances

func (*BankAccountBalanceFilterInput) ToFilter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type BankAccountBalanceInput

type BankAccountBalanceInput struct {
	ID            uuid.UUID           `json:"id"`
	BankAccountID uuid.UUID           `json:"bankAccountId"`
	Date          cachetime.CacheTime `json:"date"`
	Balance       float64             `json:"balance"`
}

BankAccountBalanceInput represents an input struct for Bank Account Balance entity

type BankAccountBalanceOutput

type BankAccountBalanceOutput struct {
	ID            uuid.UUID            `json:"id"`
	BankAccountID uuid.UUID            `json:"bankAccountId"`
	Date          cachetime.CacheTime  `json:"date"`
	Balance       float64              `json:"balance"`
	Created       cachetime.CacheTime  `json:"created"`
	CreatedBy     uuid.UUID            `json:"createdBy"`
	Updated       cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy     nuuid.NUUID          `json:"updatedBy,omitempty"`
	Deleted       cachetime.NCacheTime `json:"deleted,omitempty"`
	DeletedBy     nuuid.NUUID          `json:"deletedBy,omitempty"`
}

BankAccountBalanceOutput is the JSON-compatible object representation of Bank Account Balance

type BankAccountFilterInput

type BankAccountFilterInput struct {
	filter.BaseFilterInput
}

BankAccountFilterInput is the filter input object for Bank Accounts

func (*BankAccountFilterInput) ToFilter

func (f *BankAccountFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type BankAccountInput

type BankAccountInput struct {
	ID                uuid.UUID           `json:"id"`
	AccountName       string              `json:"accountName"`
	BankName          string              `json:"bankName"`
	AccountHolderName string              `json:"accountHolderName"`
	AccountNumber     string              `json:"accountNumber"`
	LastBalance       float64             `json:"lastBalance"`
	LastBalanceDate   cachetime.CacheTime `json:"lastBalanceDate"`
	Status            BankAccountStatus   `json:"status"`
}

BankAccountInput represents an input struct for Bank Account entity

type BankAccountOutput

type BankAccountOutput struct {
	ID                uuid.UUID                  `json:"id"`
	AccountName       string                     `json:"accountName"`
	BankName          string                     `json:"bankName"`
	AccountHolderName string                     `json:"accountHolderName"`
	AccountNumber     string                     `json:"accountNumber"`
	LastBalance       float64                    `json:"lastBalance"`
	LastBalanceDate   cachetime.CacheTime        `json:"lastBalanceDate"`
	Status            BankAccountStatus          `json:"status"`
	Created           cachetime.CacheTime        `json:"created"`
	CreatedBy         uuid.UUID                  `json:"createdBy"`
	Updated           cachetime.NCacheTime       `json:"updated,omitempty"`
	UpdatedBy         nuuid.NUUID                `json:"updatedBy,omitempty"`
	Deleted           cachetime.NCacheTime       `json:"deleted,omitempty"`
	DeletedBy         nuuid.NUUID                `json:"deletedBy,omitempty"`
	Balances          []BankAccountBalanceOutput `json:"balances"`
}

BankAccountOutput is the JSON-compatible object representation of Bank Account

type BankAccountStatus

type BankAccountStatus string

BankAccountStatus indicates the status of a Bank Account

const (
	// BankAccountStatusActive indicates an active Bank Account
	BankAccountStatusActive BankAccountStatus = "active"
	// BankAccountStatusInactive indicates an inactive Bank Account
	BankAccountStatusInactive BankAccountStatus = "inactive"
)

type PageInfoOutput

type PageInfoOutput struct {
	Page       int `json:"page"`
	PageSize   int `json:"pageSize"`
	TotalCount int `json:"totalCount"`
	PageCount  int `json:"pageCount"`
}

PageInfoOutput represents information related to a particular page output

type PageOutput

type PageOutput struct {
	Items    interface{}    `json:"items"`
	PageInfo PageInfoOutput `json:"pageInfo"`
}

PageOutput is a wrapper for any output that requires pagination information

type Property

type Property struct {
	ID                        uuid.UUID        `db:"entity_id" validate:"min=36,max=36"`
	Name                      string           `db:"name" validate:"max=255"`
	Address                   string           `db:"address" validate:"max=255"`
	TotalArea                 float64          `db:"total_area" validate:"max=255"`
	BuildingArea              float64          `db:"building_area" validate:"min=0"`
	AreaUnit                  PropertyAreaUnit `db:"area_unit"`
	Type                      PropertyType     `db:"type"`
	TitleHolder               string           `db:"title_holder" validate:"max=255"`
	TaxIdentifier             string           `db:"tax_identifier" validate:"max=255"`
	PurchaseDate              time.Time        `db:"purchase_date"`
	InitialValue              float64          `db:"initial_value" validate:"min=0"`
	InitialValueDate          time.Time        `db:"initial_value_date"`
	CurrentValue              float64          `db:"current_value" validate:"min=0"`
	CurrentValueDate          time.Time        `db:"current_value_date"`
	AnnualAppreciationPercent float64          `db:"annual_appreciation_percent"`
	Status                    PropertyStatus   `db:"status"`
	Created                   time.Time        `db:"created"`
	CreatedBy                 uuid.UUID        `db:"created_by" validate:"min=36,max=36"`
	Updated                   null.Time        `db:"updated"`
	UpdatedBy                 nuuid.NUUID      `db:"updated_by" validate:"min=36,max=36"`
	Deleted                   null.Time        `db:"deleted"`
	DeletedBy                 nuuid.NUUID      `db:"deleted_by" validate:"min=36,max=36"`
	Values                    []PropertyValue  `db:"-"`
}

Property represents a Property object

func NewPropertyFromInput

func NewPropertyFromInput(input PropertyInput, userID uuid.UUID) (p Property)

NewPropertyFromInput creates a new Property from its input object

func (*Property) AttachValues

func (p *Property) AttachValues(values []PropertyValue, clearBeforeAttach bool)

AttachValues attaches Property Values to a Property

func (*Property) Delete

func (p *Property) Delete(userID uuid.UUID) error

Delete performs a delete on a Property

func (*Property) SetCurrentValue

func (p *Property) SetCurrentValue(input PropertyValueInput, userID uuid.UUID) error

SetCurrentValue sets a new current value and current value date on a Property

func (*Property) ToOutput

func (p *Property) ToOutput() PropertyOutput

ToOutput converts a Property to its JSON-compatible object representation

func (*Property) Update

func (p *Property) Update(input PropertyInput, userID uuid.UUID) error

Update performs an update on a Property

type PropertyAreaUnit

type PropertyAreaUnit string
const (
	// PropertyAreaUnitSQFT indicates a property with areas measured in square feet
	PropertyAreaUnitSQFT PropertyAreaUnit = "sqft"
	// PropertyAreaUnitSQM indicates a property with areas measured in square meters
	PropertyAreaUnitSQM PropertyAreaUnit = "sqm"
)

type PropertyFilterInput

type PropertyFilterInput struct {
	filter.BaseFilterInput
}

PropertyFilterInput is the filter input object for Propertys

func (*PropertyFilterInput) ToFilter

func (f *PropertyFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter to a generic filter.Filter object

type PropertyInput

type PropertyInput struct {
	ID                        uuid.UUID           `json:"id"`
	Name                      string              `json:"name"`
	Address                   string              `json:"address"`
	TotalArea                 float64             `json:"totalArea"`
	BuildingArea              float64             `json:"buildingArea"`
	AreaUnit                  PropertyAreaUnit    `json:"areaUnit"`
	Type                      PropertyType        `json:"type"`
	TitleHolder               string              `json:"titleHolder"`
	TaxIdentifier             string              `json:"taxIdentifier"`
	PurchaseDate              cachetime.CacheTime `json:"purchaseDate"`
	InitialValue              float64             `json:"initialValue"`
	InitialValueDate          cachetime.CacheTime `json:"initialValueDate"`
	CurrentValue              float64             `json:"currentValue"`
	CurrentValueDate          cachetime.CacheTime `json:"currentValueDate"`
	AnnualAppreciationPercent float64             `json:"annualAppreciationPercent"`
	Status                    PropertyStatus      `json:"status"`
}

PropertyInput represents an input struct for Property entity

type PropertyOutput

type PropertyOutput struct {
	ID                        uuid.UUID             `json:"id"`
	Name                      string                `json:"name"`
	Address                   string                `json:"address"`
	TotalArea                 float64               `json:"totalArea"`
	BuildingArea              float64               `json:"buildingArea"`
	AreaUnit                  PropertyAreaUnit      `json:"areaUnit"`
	Type                      PropertyType          `json:"type"`
	TitleHolder               string                `json:"titleHolder"`
	TaxIdentifier             string                `json:"taxIdentifier"`
	PurchaseDate              cachetime.CacheTime   `json:"purchaseDate"`
	InitialValue              float64               `json:"initialValue"`
	InitialValueDate          cachetime.CacheTime   `json:"initialValueDate"`
	CurrentValue              float64               `json:"currentValue"`
	CurrentValueDate          cachetime.CacheTime   `json:"currentValueDate"`
	AnnualAppreciationPercent float64               `json:"annualAppreciationPercent"`
	Status                    PropertyStatus        `json:"status"`
	Created                   cachetime.CacheTime   `json:"created"`
	CreatedBy                 uuid.UUID             `json:"createdBy"`
	Updated                   cachetime.NCacheTime  `json:"updated,omitempty"`
	UpdatedBy                 nuuid.NUUID           `json:"updatedBy,omitempty"`
	Deleted                   cachetime.NCacheTime  `json:"deleted,omitempty"`
	DeletedBy                 nuuid.NUUID           `json:"deletedBy,omitempty"`
	Values                    []PropertyValueOutput `json:"values"`
}

PropertyOutput is the JSON-compatible object representation of Property

type PropertyStatus

type PropertyStatus string
const (
	// PropertyStatusNotInUse indicates a property that is not actively in use
	PropertyStatusNotInUse PropertyStatus = "not_in_use"
	// PropertyStatusInUse indicates a property that is actively in use
	PropertyStatusInUse PropertyStatus = "in_use"
	// PropertyStatusRetired indicates a property that is rented out
	PropertyStatusRented PropertyStatus = "rented"
	// PropertyStatusSold indicates a property that has been sold
	PropertyStatusSold PropertyStatus = "sold"
)

type PropertyType

type PropertyType string
const (
	// PropertyTypeLand indicates a property of type Land
	PropertyTypeLand PropertyType = "land"
	// PropertyTypeHouse indicates a property of type House
	PropertyTypeHouse PropertyType = "house"
	// PropertyTypeApartment indicates a property of type Apartment
	PropertyTypeApartment PropertyType = "apartment"
)

type PropertyValue

type PropertyValue struct {
	ID         uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	PropertyID uuid.UUID   `db:"property_entity_id" validate:"min=36,max=36"`
	Date       time.Time   `db:"date"`
	Value      float64     `db:"value" validate:"min=0"`
	Created    time.Time   `db:"created"`
	CreatedBy  uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated    null.Time   `db:"updated"`
	UpdatedBy  nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
	Deleted    null.Time   `db:"deleted"`
	DeletedBy  nuuid.NUUID `db:"deleted_by" validate:"min=36,max=36"`
}

PropertyValue represents a snapshot of a Property's value at a given time

func NewPropertyValueFromInput

func NewPropertyValueFromInput(input PropertyValueInput, propertyID uuid.UUID, userID uuid.UUID) (pv PropertyValue)

func (*PropertyValue) Delete

func (pv *PropertyValue) Delete(userID uuid.UUID) error

Delete performs a delete on a Property Value

func (*PropertyValue) ToOutput

func (pv *PropertyValue) ToOutput() PropertyValueOutput

ToOutput converts a Property Value to its JSON-compatible object representation

func (*PropertyValue) Update

func (pv *PropertyValue) Update(input PropertyValueInput, userID uuid.UUID) error

Update performs an update on a Property Value

type PropertyValueFilterInput

type PropertyValueFilterInput struct {
	filter.BaseFilterInput
	PropertyIDs *[]uuid.UUID         `json:"propertyIDs,omitempty"`
	StartDate   cachetime.NCacheTime `json:"startDate,omitempty"`
	EndDate     cachetime.NCacheTime `json:"endDate,omitempty"`
	ValueMin    *float64             `json:"valueMin,omitempty"`
	ValueMax    *float64             `json:"valueMax,omitempty"`
}

func (*PropertyValueFilterInput) ToFilter

func (f *PropertyValueFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter to a generic filter.Filter object

type PropertyValueInput

type PropertyValueInput struct {
	ID         uuid.UUID           `json:"id"`
	PropertyID uuid.UUID           `json:"propertyId"`
	Date       cachetime.CacheTime `json:"date"`
	Value      float64             `json:"value"`
}

PropertyValueInput represents an input struct for Property Value entity

type PropertyValueOutput

type PropertyValueOutput struct {
	ID         uuid.UUID            `json:"id"`
	PropertyID uuid.UUID            `json:"propertyId"`
	Date       cachetime.CacheTime  `json:"date"`
	Value      float64              `json:"value"`
	Created    cachetime.CacheTime  `json:"created"`
	CreatedBy  uuid.UUID            `json:"createdBy"`
	Updated    cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy  nuuid.NUUID          `json:"updatedBy,omitempty"`
	Deleted    cachetime.NCacheTime `json:"deleted,omitempty"`
	DeletedBy  nuuid.NUUID          `json:"deletedBy,omitempty"`
}

PropertyValueOutput is the JSON-compatible object representation of Property Value

type User

type User struct {
	ID        uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	Username  string      `db:"username"`
	Email     string      `db:"email"`
	Password  string      `db:"password"`
	Name      string      `db:"name"`
	Created   time.Time   `db:"created"`
	CreatedBy uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated   null.Time   `db:"updated"`
	UpdatedBy nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
}

User represents a User entity object

func NewUserFromInput

func NewUserFromInput(input UserInput, userID uuid.UUID) (u User)

NewUserFromInput creates a new User from its input struct

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

ComparePassword compares a User's password in storage against an input

func (*User) SetPassword

func (u *User) SetPassword(password string, userID uuid.UUID) error

SetPassword sets a User's password

func (*User) ToOutput

func (u *User) ToOutput() UserOutput

ToOutput converts a User to its JSON-compatible object representation

func (*User) Update

func (u *User) Update(input UserInput, userID uuid.UUID) error

Update performs an update on a User

type UserFilterInput

type UserFilterInput struct {
	filter.BaseFilterInput
	IDs *[]uuid.UUID `json:"ids,omitempty"`
}

UserFilterInput is the filter input object for Users

func (*UserFilterInput) ToFilter

func (f *UserFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type UserInput

type UserInput struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username"`
	Email    string    `json:"email"`
	Password string    `json:"password"`
	Name     string    `json:"name"`
}

UserInput represents an input struct for User entity

type UserOutput

type UserOutput struct {
	ID        uuid.UUID            `json:"id"`
	Username  string               `json:"username"`
	Email     string               `json:"email"`
	Password  string               `json:"password"`
	Name      string               `json:"name"`
	Created   cachetime.CacheTime  `json:"created"`
	CreatedBy uuid.UUID            `json:"createdBy"`
	Updated   cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy nuuid.NUUID          `json:"updatedBy,omitempty"`
}

UserOutput is the JSON-compatible object representation of User

type Vehicle

type Vehicle struct {
	ID                        uuid.UUID      `db:"entity_id" validate:"min=36,max=36"`
	Name                      string         `db:"name" validate:"max=255"`
	Make                      string         `db:"make" validate:"max=255"`
	Model                     string         `db:"model" validate:"max=255"`
	Year                      int            `db:"year" validate:"min=0"`
	Type                      VehicleType    `db:"type"`
	TitleHolder               string         `db:"title_holder" validate:"max=255"`
	LicensePlateNumber        string         `db:"license_plate_number" validate:"max=255"`
	PurchaseDate              time.Time      `db:"purchase_date"`
	InitialValue              float64        `db:"initial_value" validate:"min=0"`
	InitialValueDate          time.Time      `db:"initial_value_date"`
	CurrentValue              float64        `db:"current_value" validate:"min=0"`
	CurrentValueDate          time.Time      `db:"current_value_date"`
	AnnualDepreciationPercent float64        `db:"annual_depreciation_percent"`
	Status                    VehicleStatus  `db:"status"`
	Created                   time.Time      `db:"created"`
	CreatedBy                 uuid.UUID      `db:"created_by" validate:"min=36,max=36"`
	Updated                   null.Time      `db:"updated"`
	UpdatedBy                 nuuid.NUUID    `db:"updated_by" validate:"min=36,max=36"`
	Deleted                   null.Time      `db:"deleted"`
	DeletedBy                 nuuid.NUUID    `db:"deleted_by" validate:"min=36,max=36"`
	Values                    []VehicleValue `db:"-"`
}

Vehicle represents a Vehicle object

func NewVehicleFromInput

func NewVehicleFromInput(input VehicleInput, userID uuid.UUID) (v Vehicle)

NewVehicleFromInput creates a new Vehicle from its input object

func (*Vehicle) AttachValues

func (v *Vehicle) AttachValues(values []VehicleValue, clearBeforeAttach bool)

AttachValues attaches Vehicle Values to a Vehicle

func (*Vehicle) Delete

func (v *Vehicle) Delete(userID uuid.UUID) error

Delete performs a delete on a Vehicle

func (*Vehicle) SetCurrentValue

func (v *Vehicle) SetCurrentValue(input VehicleValueInput, userID uuid.UUID) error

SetCurrentValue sets a new current value and current value date on a Vehicle

func (*Vehicle) ToOutput

func (v *Vehicle) ToOutput() VehicleOutput

ToOutput converts a Vehicle to its JSON-compatible object representation

func (*Vehicle) Update

func (v *Vehicle) Update(input VehicleInput, userID uuid.UUID) error

Update performs an update on a Vehicle

type VehicleFilterInput

type VehicleFilterInput struct {
	filter.BaseFilterInput
}

VehicleFilterInput is the filter input object for Vehicles

func (*VehicleFilterInput) ToFilter

func (f *VehicleFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter to a generic filter.Filter object

type VehicleInput

type VehicleInput struct {
	ID                        uuid.UUID           `json:"id"`
	Name                      string              `json:"name"`
	Make                      string              `json:"make"`
	Model                     string              `json:"model"`
	Year                      int                 `json:"year"`
	Type                      VehicleType         `json:"type"`
	TitleHolder               string              `json:"titleHolder"`
	LicensePlateNumber        string              `json:"licensePlateNumber"`
	PurchaseDate              cachetime.CacheTime `json:"purchaseDate"`
	InitialValue              float64             `json:"initialValue"`
	InitialValueDate          cachetime.CacheTime `json:"initialValueDate"`
	CurrentValue              float64             `json:"currentValue"`
	CurrentValueDate          cachetime.CacheTime `json:"currentValueDate"`
	AnnualDepreciationPercent float64             `json:"annualDepreciationPercent"`
	Status                    VehicleStatus       `json:"status"`
}

VehicleInput represents an input struct for Vehicle entity

type VehicleOutput

type VehicleOutput struct {
	ID                        uuid.UUID            `json:"id"`
	Name                      string               `json:"name"`
	Make                      string               `json:"make"`
	Model                     string               `json:"model"`
	Year                      int                  `json:"year"`
	Type                      VehicleType          `json:"type"`
	TitleHolder               string               `json:"titleHolder"`
	LicensePlateNumber        string               `json:"licensePlateNumber"`
	PurchaseDate              cachetime.CacheTime  `json:"purchaseDate"`
	InitialValue              float64              `json:"initialValue"`
	InitialValueDate          cachetime.CacheTime  `json:"initialValueDate"`
	CurrentValue              float64              `json:"currentValue"`
	CurrentValueDate          cachetime.CacheTime  `json:"currentValueDate"`
	AnnualDepreciationPercent float64              `json:"annualDepreciationPercent"`
	Status                    VehicleStatus        `json:"status"`
	Created                   cachetime.CacheTime  `json:"created"`
	CreatedBy                 uuid.UUID            `json:"createdBy"`
	Updated                   cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy                 nuuid.NUUID          `json:"updatedBy,omitempty"`
	Deleted                   cachetime.NCacheTime `json:"deleted,omitempty"`
	DeletedBy                 nuuid.NUUID          `json:"deletedBy,omitempty"`
	Values                    []VehicleValueOutput `json:"values"`
}

VehicleOutput is the JSON-compatible object representation of Vehicle

type VehicleStatus

type VehicleStatus string
const (
	// VehicleStatusInUse indicates a vehicle that is actively in use
	VehicleStatusInUse VehicleStatus = "in_use"
	// VehicleStatusRetired indicates a vehicle that is no longer in use
	VehicleStatusRetired VehicleStatus = "retired"
	// VehicleStatusSold indicates a vehicle that has been sold
	VehicleStatusSold VehicleStatus = "sold"
)

type VehicleType

type VehicleType string
const (
	// VehicleTypeCar indicates a vehicle of type Car
	VehicleTypeCar VehicleType = "car"
	// VehicleTypeTruck indicates a vehicle of type Truck
	VehicleTypeTruck VehicleType = "truck"
	// VehicleTypeBicycle indicates a vehicle of type Bicycle
	VehicleTypeBicycle VehicleType = "bicycle"
	// VehicleTypeOther indicates a vehicle of type Other
	VehicleTypeOther VehicleType = "other"
)

type VehicleValue

type VehicleValue struct {
	ID        uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	VehicleID uuid.UUID   `db:"vehicle_entity_id" validate:"min=36,max=36"`
	Date      time.Time   `db:"date"`
	Value     float64     `db:"value" validate:"min=0"`
	Created   time.Time   `db:"created"`
	CreatedBy uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated   null.Time   `db:"updated"`
	UpdatedBy nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
	Deleted   null.Time   `db:"deleted"`
	DeletedBy nuuid.NUUID `db:"deleted_by" validate:"min=36,max=36"`
}

VehicleValue represents a snapshot of a Vehicle's value at a given time

func NewVehicleValueFromInput

func NewVehicleValueFromInput(input VehicleValueInput, vehicleID uuid.UUID, userID uuid.UUID) (vv VehicleValue)

func (*VehicleValue) Delete

func (vv *VehicleValue) Delete(userID uuid.UUID) error

Delete performs a delete on a Vehicle Value

func (*VehicleValue) ToOutput

func (vv *VehicleValue) ToOutput() VehicleValueOutput

ToOutput converts a Vehicle Value to its JSON-compatible object representation

func (*VehicleValue) Update

func (vv *VehicleValue) Update(input VehicleValueInput, userID uuid.UUID) error

Update performs an update on a Vehicle Value

type VehicleValueFilterInput

type VehicleValueFilterInput struct {
	filter.BaseFilterInput
	VehicleIDs *[]uuid.UUID         `json:"vehicleIDs,omitempty"`
	StartDate  cachetime.NCacheTime `json:"startDate,omitempty"`
	EndDate    cachetime.NCacheTime `json:"endDate,omitempty"`
	ValueMin   *float64             `json:"valueMin,omitempty"`
	ValueMax   *float64             `json:"valueMax,omitempty"`
}

func (*VehicleValueFilterInput) ToFilter

func (f *VehicleValueFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter to a generic filter.Filter object

type VehicleValueInput

type VehicleValueInput struct {
	ID        uuid.UUID           `json:"id"`
	VehicleID uuid.UUID           `json:"vehicleId"`
	Date      cachetime.CacheTime `json:"date"`
	Value     float64             `json:"value"`
}

VehicleValueInput represents an input struct for Vehicle Value entity

type VehicleValueOutput

type VehicleValueOutput struct {
	ID        uuid.UUID            `json:"id"`
	VehicleID uuid.UUID            `json:"vehicleId"`
	Date      cachetime.CacheTime  `json:"date"`
	Value     float64              `json:"value"`
	Created   cachetime.CacheTime  `json:"created"`
	CreatedBy uuid.UUID            `json:"createdBy"`
	Updated   cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy nuuid.NUUID          `json:"updatedBy,omitempty"`
	Deleted   cachetime.NCacheTime `json:"deleted,omitempty"`
	DeletedBy nuuid.NUUID          `json:"deletedBy,omitempty"`
}

VehicleValueOutput is the JSON-compatible object representation of Vehicle Value

Jump to

Keyboard shortcuts

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