models

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const LevelOneAccountParentId = 0

LevelOneAccountParentId represents the parent id of level-one account

View Source
const LevelOneTransactionParentId = 0

LevelOneTransactionParentId represents the parent id of level-one transaction category

View Source
const TokenMaxUserAgentLength = 255

TokenMaxUserAgentLength represents the maximum size of user agent stored in database

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountId       int64           `xorm:"PK"`
	Uid             int64           `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"`
	Deleted         bool            `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"`
	Category        AccountCategory `xorm:"NOT NULL"`
	OpenDate        int64           `xorm:""`
	ExpirationDate  int64           `xorm:""`
	Type            AccountType     `xorm:"NOT NULL"`
	ParentAccountId int64           `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"`
	Name            string          `xorm:"VARCHAR(32) NOT NULL"`
	DisplayOrder    int32           `xorm:"INDEX(IDX_account_uid_deleted_parent_account_id_order) NOT NULL"`
	Icon            int64           `xorm:"NOT NULL"`
	Color           string          `xorm:"VARCHAR(6) NOT NULL"`
	Currency        string          `xorm:"VARCHAR(3) NOT NULL"`
	Balance         int64           `xorm:"NOT NULL"`
	Comment         string          `xorm:"VARCHAR(255) NOT NULL"`
	Hidden          bool            `xorm:"NOT NULL"`
	CreatedUnixTime int64
	UpdatedUnixTime int64
	DeletedUnixTime int64
}

Account represents account data stored in database

func (*Account) ToAccountInfoResponse

func (a *Account) ToAccountInfoResponse() *AccountInfoResponse

ToAccountInfoResponse returns a view-object according to database model

type AccountCategory

type AccountCategory byte

AccountCategory represents account category

const (
	ACCOUNT_CATEGORY_CASH        AccountCategory = 1
	ACCOUNT_CATEGORY_DEBIT_CARD  AccountCategory = 2
	ACCOUNT_CATEGORY_CREDIT_CARD AccountCategory = 3
	ACCOUNT_CATEGORY_VIRTUAL     AccountCategory = 4
	ACCOUNT_CATEGORY_DEBT        AccountCategory = 5
	ACCOUNT_CATEGORY_RECEIVABLES AccountCategory = 6
	ACCOUNT_CATEGORY_INVESTMENT  AccountCategory = 7
	ACCOUNT_CATEGORY_SAVING      AccountCategory = 8
)

Account categories

type AccountCreateRequest

type AccountCreateRequest struct {
	Name           string                  `json:"name" binding:"required,notBlank,max=32"`
	Category       AccountCategory         `json:"category" binding:"required"`
	Type           AccountType             `json:"type" binding:"required"`
	OpenDate       int64                   `json:"openDate"`
	ExpirationDate int64                   `json:"expirationDate"`
	Icon           int64                   `json:"icon,string" binding:"required,min=1"`
	Color          string                  `json:"color" binding:"required,len=6,validHexRGBColor"`
	Currency       string                  `json:"currency" binding:"required,len=3,validCurrency"`
	Balance        int64                   `json:"balance"`
	Comment        string                  `json:"comment" binding:"max=255"`
	SubAccounts    []*AccountCreateRequest `json:"subAccounts" binding:"omitempty"`
}

AccountCreateRequest represents all parameters of account creation request

type AccountDeleteRequest

type AccountDeleteRequest struct {
	Id int64 `json:"id,string" binding:"required,min=1"`
}

AccountDeleteRequest represents all parameters of account deleting request

type AccountGetRequest

type AccountGetRequest struct {
	Id int64 `form:"id,string" binding:"required,min=1"`
}

AccountGetRequest represents all parameters of account getting request

type AccountHideRequest

type AccountHideRequest struct {
	Id     int64 `json:"id,string" binding:"required,min=1"`
	Hidden bool  `json:"hidden"`
}

AccountHideRequest represents all parameters of account hiding request

type AccountInfoResponse

type AccountInfoResponse struct {
	Id             int64                    `json:"id,string"`
	Name           string                   `json:"name"`
	ParentId       int64                    `json:"parentId,string"`
	Category       AccountCategory          `json:"category"`
	Type           AccountType              `json:"type"`
	OpenDate       int64                    `json:"openDate"`
	ExpirationDate int64                    `json:"expirationDate"`
	Icon           int64                    `json:"icon,string"`
	Color          string                   `json:"color"`
	Currency       string                   `json:"currency"`
	Balance        int64                    `json:"balance"`
	Comment        string                   `json:"comment"`
	DisplayOrder   int32                    `json:"displayOrder"`
	IsAsset        bool                     `json:"isAsset,omitempty"`
	IsLiability    bool                     `json:"isLiability,omitempty"`
	Hidden         bool                     `json:"hidden"`
	SubAccounts    AccountInfoResponseSlice `json:"subAccounts,omitempty"`
}

AccountInfoResponse represents a view-object of account

type AccountInfoResponseSlice

type AccountInfoResponseSlice []*AccountInfoResponse

AccountInfoResponseSlice represents the slice data structure of AccountInfoResponse

func (AccountInfoResponseSlice) Len

func (a AccountInfoResponseSlice) Len() int

Len returns the count of items

func (AccountInfoResponseSlice) Less

func (a AccountInfoResponseSlice) Less(i, j int) bool

Less reports whether the first item is less than the second one

func (AccountInfoResponseSlice) Swap

func (a AccountInfoResponseSlice) Swap(i, j int)

Swap swaps two items

type AccountListRequest

type AccountListRequest struct {
	VisibleOnly bool `form:"visible_only"`
}

AccountListRequest represents all parameters of account listing request

type AccountModifyRequest

type AccountModifyRequest struct {
	Id             int64                   `json:"id,string" binding:"required,min=1"`
	Name           string                  `json:"name" binding:"required,notBlank,max=32"`
	Category       AccountCategory         `json:"category" binding:"required"`
	Icon           int64                   `json:"icon,string" binding:"min=1"`
	OpenDate       int64                   `json:"openDate"`
	ExpirationDate int64                   `json:"expirationDate"`
	Color          string                  `json:"color" binding:"required,len=6,validHexRGBColor"`
	Comment        string                  `json:"comment" binding:"max=255"`
	Hidden         bool                    `json:"hidden"`
	SubAccounts    []*AccountModifyRequest `json:"subAccounts" binding:"omitempty"`
}

AccountModifyRequest represents all parameters of account modification request

type AccountMoveRequest

type AccountMoveRequest struct {
	NewDisplayOrders []*AccountNewDisplayOrderRequest `json:"newDisplayOrders"`
}

AccountMoveRequest represents all parameters of account moving request

type AccountNewDisplayOrderRequest

type AccountNewDisplayOrderRequest struct {
	Id           int64 `json:"id,string" binding:"required,min=1"`
	DisplayOrder int32 `json:"displayOrder"`
}

AccountNewDisplayOrderRequest represents a data pair of id and display order

type AccountType

type AccountType byte

AccountType represents account type

const (
	ACCOUNT_TYPE_SINGLE_ACCOUNT     AccountType = 1
	ACCOUNT_TYPE_MULTI_SUB_ACCOUNTS AccountType = 2
)

Account types

type AuthResponse

type AuthResponse struct {
	Token   string         `json:"token"`
	Need2FA bool           `json:"need2FA"`
	User    *UserBasicInfo `json:"user"`
}

AuthResponse returns a view-object of user authorization

type ClearDataRequest

type ClearDataRequest struct {
	Password string `json:"password" binding:"omitempty,min=6,max=128"`
}

ClearDataRequest represents all parameters of clear user data request

type DataStatisticsResponse

type DataStatisticsResponse struct {
	TotalAccountCount             int64 `json:"totalAccountCount,string"`
	TotalTransactionCategoryCount int64 `json:"totalTransactionCategoryCount,string"`
	TotalTransactionTagCount      int64 `json:"totalTransactionTagCount,string"`
	TotalTransactionCount         int64 `json:"totalTransactionCount,string"`
}

DataStatisticsResponse represents a view-object of user data statistic

type ForgetPasswordRequest

type ForgetPasswordRequest struct {
	Email string `json:"email" binding:"required,notBlank,max=100,validEmail"`
}

ForgetPasswordRequest represents all parameters of forget password request

type LatestExchangeRate

type LatestExchangeRate struct {
	Currency string `json:"currency"`
	Rate     string `json:"rate"`
}

LatestExchangeRate represents a data pair of currency and exchange rate

type LatestExchangeRateResponse

type LatestExchangeRateResponse struct {
	DataSource    string                  `json:"dataSource"`
	ReferenceUrl  string                  `json:"referenceUrl"`
	UpdateTime    int64                   `json:"updateTime"`
	BaseCurrency  string                  `json:"baseCurrency"`
	ExchangeRates LatestExchangeRateSlice `json:"exchangeRates"`
}

LatestExchangeRateResponse returns a view-object which contains latest exchange rate

type LatestExchangeRateSlice

type LatestExchangeRateSlice []*LatestExchangeRate

LatestExchangeRateSlice represents the slice data structure of LatestExchangeRate

func (LatestExchangeRateSlice) Len

func (s LatestExchangeRateSlice) Len() int

Len returns the count of items

func (LatestExchangeRateSlice) Less

func (s LatestExchangeRateSlice) Less(i, j int) bool

Less reports whether the first item is less than the second one

func (LatestExchangeRateSlice) Swap

func (s LatestExchangeRateSlice) Swap(i, j int)

Swap swaps two items

type LongDateFormat

type LongDateFormat byte

LongDateFormat represents long date format

const (
	LONG_DATE_FORMAT_DEFAULT  LongDateFormat = 0
	LONG_DATE_FORMAT_YYYY_M_D LongDateFormat = 1
	LONG_DATE_FORMAT_M_D_YYYY LongDateFormat = 2
	LONG_DATE_FORMAT_D_M_YYYY LongDateFormat = 3
	LONG_DATE_FORMAT_INVALID  LongDateFormat = 255
)

Long Date Format

func (LongDateFormat) String

func (f LongDateFormat) String() string

String returns a textual representation of the long date format enum

type LongTimeFormat

type LongTimeFormat byte

LongTimeFormat represents long time format

const (
	LONG_TIME_FORMAT_DEFAULT    LongTimeFormat = 0
	LONG_TIME_FORMAT_HH_MM_SS   LongTimeFormat = 1
	LONG_TIME_FORMAT_A_HH_MM_SS LongTimeFormat = 2
	LONG_TIME_FORMAT_HH_MM_SS_A LongTimeFormat = 3
	LONG_TIME_FORMAT_INVALID    LongTimeFormat = 255
)

Long Time Format

func (LongTimeFormat) String

func (f LongTimeFormat) String() string

String returns a textual representation of the long time format enum

type PasswordResetRequest

type PasswordResetRequest struct {
	Email    string `json:"email" binding:"required,notBlank,max=100,validEmail"`
	Password string `json:"password" binding:"required,min=6,max=128"`
}

PasswordResetRequest represents all parameters of reset password request

type RegisterResponse

type RegisterResponse struct {
	AuthResponse
	NeedVerifyEmail       bool `json:"needVerifyEmail"`
	PresetCategoriesSaved bool `json:"presetCategoriesSaved"`
}

RegisterResponse returns a view-object of user register response

type ShortDateFormat

type ShortDateFormat byte

ShortDateFormat represents short date format

const (
	SHORT_DATE_FORMAT_DEFAULT  ShortDateFormat = 0
	SHORT_DATE_FORMAT_YYYY_M_D ShortDateFormat = 1
	SHORT_DATE_FORMAT_M_D_YYYY ShortDateFormat = 2
	SHORT_DATE_FORMAT_D_M_YYYY ShortDateFormat = 3
	SHORT_DATE_FORMAT_INVALID  ShortDateFormat = 255
)

Short Date Format

func (ShortDateFormat) String

func (f ShortDateFormat) String() string

String returns a textual representation of the short date format enum

type ShortTimeFormat

type ShortTimeFormat byte

ShortTimeFormat represents short time format

const (
	SHORT_TIME_FORMAT_DEFAULT ShortTimeFormat = 0
	SHORT_TIME_FORMAT_HH_MM   ShortTimeFormat = 1
	SHORT_TIME_FORMAT_A_HH_MM ShortTimeFormat = 2
	SHORT_TIME_FORMAT_HH_MM_A ShortTimeFormat = 3
	SHORT_TIME_FORMAT_INVALID ShortTimeFormat = 255
)

Short Time Format

func (ShortTimeFormat) String

func (f ShortTimeFormat) String() string

String returns a textual representation of the short time format enum

type TokenInfoResponse

type TokenInfoResponse struct {
	TokenId   string         `json:"tokenId"`
	TokenType core.TokenType `json:"tokenType"`
	UserAgent string         `json:"userAgent"`
	CreatedAt int64          `json:"createdAt"`
	ExpiredAt int64          `json:"expiredAt"`
	IsCurrent bool           `json:"isCurrent"`
}

TokenInfoResponse represents a view-object of token

type TokenInfoResponseSlice

type TokenInfoResponseSlice []*TokenInfoResponse

TokenInfoResponseSlice represents the slice data structure of TokenInfoResponse

func (TokenInfoResponseSlice) Len

func (a TokenInfoResponseSlice) Len() int

Len returns the count of items

func (TokenInfoResponseSlice) Less

func (a TokenInfoResponseSlice) Less(i, j int) bool

Less reports whether the first item is less than the second one

func (TokenInfoResponseSlice) Swap

func (a TokenInfoResponseSlice) Swap(i, j int)

Swap swaps two items

type TokenRecord

type TokenRecord struct {
	Uid             int64          `xorm:"PK INDEX(IDX_token_record_uid_type_expired_time)"`
	UserTokenId     int64          `xorm:"PK"`
	TokenType       core.TokenType `xorm:"INDEX(IDX_token_record_uid_type_expired_time) TINYINT NOT NULL"`
	Secret          string         `xorm:"VARCHAR(10) NOT NULL"`
	UserAgent       string         `xorm:"VARCHAR(255)"`
	CreatedUnixTime int64          `xorm:"PK"`
	ExpiredUnixTime int64          `xorm:"INDEX(IDX_token_record_uid_type_expired_time)"`
}

TokenRecord represents token data stored in database

type TokenRefreshResponse

type TokenRefreshResponse struct {
	NewToken   string         `json:"newToken"`
	OldTokenId string         `json:"oldTokenId"`
	User       *UserBasicInfo `json:"user"`
}

TokenRefreshResponse represents all parameters of token refreshing request

type TokenRevokeRequest

type TokenRevokeRequest struct {
	TokenId string `json:"tokenId" binding:"required,notBlank"`
}

TokenRevokeRequest represents all parameters of token revoking request

type Transaction

type Transaction struct {
	TransactionId        int64             `xorm:"PK"`
	Uid                  int64             `` /* 295-byte string literal not displayed */
	Deleted              bool              `` /* 262-byte string literal not displayed */
	Type                 TransactionDbType `xorm:"INDEX(IDX_transaction_uid_deleted_type_time) NOT NULL"`
	CategoryId           int64             `xorm:"INDEX(IDX_transaction_uid_deleted_category_id_time) NOT NULL"`
	AccountId            int64             `xorm:"INDEX(IDX_transaction_uid_deleted_account_id_time) NOT NULL"`
	TransactionTime      int64             `` /* 236-byte string literal not displayed */
	TimezoneUtcOffset    int16             `xorm:"NOT NULL"`
	Amount               int64             `xorm:"NOT NULL"`
	RelatedId            int64             `xorm:"NOT NULL"`
	RelatedAccountId     int64             `xorm:"NOT NULL"`
	RelatedAccountAmount int64             `xorm:"NOT NULL"`
	HideAmount           bool              `xorm:"NOT NULL"`
	Comment              string            `xorm:"VARCHAR(255) NOT NULL"`
	GeoLongitude         float64           `xorm:"INDEX(IDX_transaction_uid_deleted_time_longitude_latitude)"`
	GeoLatitude          float64           `xorm:"INDEX(IDX_transaction_uid_deleted_time_longitude_latitude)"`
	CreatedIp            string            `xorm:"VARCHAR(39)"`
	CreatedUnixTime      int64
	UpdatedUnixTime      int64
	DeletedUnixTime      int64
}

Transaction represents transaction data stored in database

func (*Transaction) IsEditable

func (t *Transaction) IsEditable(currentUser *User, utcOffset int16, account *Account, relatedAccount *Account) bool

IsEditable returns whether this transaction can be edited

func (*Transaction) ToTransactionInfoResponse

func (t *Transaction) ToTransactionInfoResponse(tagIds []int64, editable bool) *TransactionInfoResponse

ToTransactionInfoResponse returns a view-object according to database model

type TransactionAmountsRequest

type TransactionAmountsRequest struct {
	Query                  string `form:"query"`
	UseTransactionTimezone bool   `form:"use_transaction_timezone"`
}

TransactionAmountsRequest represents all parameters of transaction amounts request

func (*TransactionAmountsRequest) GetTransactionAmountsRequestItems

func (t *TransactionAmountsRequest) GetTransactionAmountsRequestItems() ([]*TransactionAmountsRequestItem, error)

GetTransactionAmountsRequestItems returns request items by query parameters

type TransactionAmountsRequestItem

type TransactionAmountsRequestItem struct {
	Name      string
	StartTime int64
	EndTime   int64
}

TransactionAmountsRequestItem represents an item of transaction amounts request

type TransactionAmountsResponseItem

type TransactionAmountsResponseItem struct {
	StartTime int64                                       `json:"startTime"`
	EndTime   int64                                       `json:"endTime"`
	Amounts   []*TransactionAmountsResponseItemAmountInfo `json:"amounts"`
}

TransactionAmountsResponseItem represents an item of transaction amounts

type TransactionAmountsResponseItemAmountInfo

type TransactionAmountsResponseItemAmountInfo struct {
	Currency      string `json:"currency"`
	IncomeAmount  int64  `json:"incomeAmount"`
	ExpenseAmount int64  `json:"expenseAmount"`
}

TransactionAmountsResponseItemAmountInfo represents amount info for an response item

type TransactionAmountsResponseItemAmountInfoSlice

type TransactionAmountsResponseItemAmountInfoSlice []*TransactionAmountsResponseItemAmountInfo

TransactionAmountsResponseItemAmountInfoSlice represents the slice data structure of TransactionAmountsResponseItemAmountInfo

func (TransactionAmountsResponseItemAmountInfoSlice) Len

Len returns the count of items

func (TransactionAmountsResponseItemAmountInfoSlice) Less

Less reports whether the first item is less than the second one

func (TransactionAmountsResponseItemAmountInfoSlice) Swap

Swap swaps two items

type TransactionCategory

type TransactionCategory struct {
	CategoryId       int64                   `xorm:"PK"`
	Uid              int64                   `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"`
	Deleted          bool                    `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"`
	Type             TransactionCategoryType `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"`
	ParentCategoryId int64                   `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"`
	Name             string                  `xorm:"VARCHAR(32) NOT NULL"`
	DisplayOrder     int32                   `xorm:"INDEX(IDX_category_uid_deleted_type_parent_category_id_order) NOT NULL"`
	Icon             int64                   `xorm:"NOT NULL"`
	Color            string                  `xorm:"VARCHAR(6) NOT NULL"`
	Hidden           bool                    `xorm:"NOT NULL"`
	Comment          string                  `xorm:"VARCHAR(255) NOT NULL"`
	CreatedUnixTime  int64
	UpdatedUnixTime  int64
	DeletedUnixTime  int64
}

TransactionCategory represents transaction category data stored in database

func (*TransactionCategory) ToTransactionCategoryInfoResponse

func (c *TransactionCategory) ToTransactionCategoryInfoResponse() *TransactionCategoryInfoResponse

ToTransactionCategoryInfoResponse returns a view-object according to database model

type TransactionCategoryCreateBatchRequest

type TransactionCategoryCreateBatchRequest struct {
	Categories []*TransactionCategoryCreateWithSubCategories `json:"categories" binding:"required"`
}

TransactionCategoryCreateBatchRequest represents all parameters of transaction category batch creation request

type TransactionCategoryCreateRequest

type TransactionCategoryCreateRequest struct {
	Name     string                  `json:"name" binding:"required,notBlank,max=32"`
	Type     TransactionCategoryType `json:"type" binding:"required"`
	ParentId int64                   `json:"parentId,string" binding:"min=0"`
	Icon     int64                   `json:"icon,string" binding:"min=1"`
	Color    string                  `json:"color" binding:"required,len=6,validHexRGBColor"`
	Comment  string                  `json:"comment" binding:"max=255"`
}

TransactionCategoryCreateRequest represents all parameters of single transaction category creation request

type TransactionCategoryCreateWithSubCategories

type TransactionCategoryCreateWithSubCategories struct {
	Name          string                              `json:"name" binding:"required,notBlank,max=32"`
	Type          TransactionCategoryType             `json:"type" binding:"required"`
	Icon          int64                               `json:"icon,string" binding:"min=1"`
	Color         string                              `json:"color" binding:"required,len=6,validHexRGBColor"`
	Comment       string                              `json:"comment" binding:"max=255"`
	SubCategories []*TransactionCategoryCreateRequest `json:"subCategories" binding:"required"`
}

TransactionCategoryCreateWithSubCategories represents all parameters of multi transaction categories creation request

type TransactionCategoryDeleteRequest

type TransactionCategoryDeleteRequest struct {
	Id int64 `json:"id,string" binding:"required,min=1"`
}

TransactionCategoryDeleteRequest represents all parameters of transaction category deleting request

type TransactionCategoryGetRequest

type TransactionCategoryGetRequest struct {
	Id int64 `form:"id,string" binding:"required,min=1"`
}

TransactionCategoryGetRequest represents all parameters of transaction category getting request

type TransactionCategoryHideRequest

type TransactionCategoryHideRequest struct {
	Id     int64 `json:"id,string" binding:"required,min=1"`
	Hidden bool  `json:"hidden"`
}

TransactionCategoryHideRequest represents all parameters of transaction category hiding request

type TransactionCategoryInfoResponse

type TransactionCategoryInfoResponse struct {
	Id            int64                                `json:"id,string"`
	Name          string                               `json:"name"`
	ParentId      int64                                `json:"parentId,string"`
	Type          TransactionCategoryType              `json:"type"`
	Icon          int64                                `json:"icon,string"`
	Color         string                               `json:"color"`
	Comment       string                               `json:"comment"`
	DisplayOrder  int32                                `json:"displayOrder"`
	Hidden        bool                                 `json:"hidden"`
	SubCategories TransactionCategoryInfoResponseSlice `json:"subCategories,omitempty"`
}

TransactionCategoryInfoResponse represents a view-object of transaction category

type TransactionCategoryInfoResponseSlice

type TransactionCategoryInfoResponseSlice []*TransactionCategoryInfoResponse

TransactionCategoryInfoResponseSlice represents the slice data structure of TransactionCategoryInfoResponse

func (TransactionCategoryInfoResponseSlice) Len

Len returns the count of items

func (TransactionCategoryInfoResponseSlice) Less

Less reports whether the first item is less than the second one

func (TransactionCategoryInfoResponseSlice) Swap

Swap swaps two items

type TransactionCategoryListRequest

type TransactionCategoryListRequest struct {
	Type     TransactionCategoryType `form:"type" binding:"min=0"`
	ParentId int64                   `form:"parent_id,string,default=-1" binding:"min=-1"`
}

TransactionCategoryListRequest represents all parameters of transaction category listing request

type TransactionCategoryModifyRequest

type TransactionCategoryModifyRequest struct {
	Id      int64  `json:"id,string" binding:"required,min=1"`
	Name    string `json:"name" binding:"required,notBlank,max=32"`
	Icon    int64  `json:"icon,string" binding:"min=1"`
	Color   string `json:"color" binding:"required,len=6,validHexRGBColor"`
	Comment string `json:"comment" binding:"max=255"`
	Hidden  bool   `json:"hidden"`
}

TransactionCategoryModifyRequest represents all parameters of transaction category modification request

type TransactionCategoryMoveRequest

type TransactionCategoryMoveRequest struct {
	NewDisplayOrders []*TransactionCategoryNewDisplayOrderRequest `json:"newDisplayOrders"`
}

TransactionCategoryMoveRequest represents all parameters of transaction category moving request

type TransactionCategoryNewDisplayOrderRequest

type TransactionCategoryNewDisplayOrderRequest struct {
	Id           int64 `json:"id,string" binding:"required,min=1"`
	DisplayOrder int32 `json:"displayOrder"`
}

TransactionCategoryNewDisplayOrderRequest represents a data pair of id and display order

type TransactionCategoryType

type TransactionCategoryType byte

TransactionCategoryType represents transaction category type

const (
	CATEGORY_TYPE_INCOME   TransactionCategoryType = 1
	CATEGORY_TYPE_EXPENSE  TransactionCategoryType = 2
	CATEGORY_TYPE_TRANSFER TransactionCategoryType = 3
)

Transaction category types

type TransactionCountRequest

type TransactionCountRequest struct {
	Type       TransactionDbType `form:"type" binding:"min=0,max=4"`
	CategoryId int64             `form:"category_id" binding:"min=0"`
	AccountId  int64             `form:"account_id" binding:"min=0"`
	Keyword    string            `form:"keyword"`
	MaxTime    int64             `form:"max_time" binding:"min=0"`
	MinTime    int64             `form:"min_time" binding:"min=0"`
}

TransactionCountRequest represents transaction count request

type TransactionCountResponse

type TransactionCountResponse struct {
	TotalCount int64 `json:"totalCount"`
}

TransactionCountResponse represents transaction count response

type TransactionCreateRequest

type TransactionCreateRequest struct {
	Type                 TransactionType                `json:"type" binding:"required"`
	CategoryId           int64                          `json:"categoryId,string"`
	Time                 int64                          `json:"time" binding:"required,min=1"`
	UtcOffset            int16                          `json:"utcOffset" binding:"min=-720,max=840"`
	SourceAccountId      int64                          `json:"sourceAccountId,string" binding:"required,min=1"`
	DestinationAccountId int64                          `json:"destinationAccountId,string" binding:"min=0"`
	SourceAmount         int64                          `json:"sourceAmount" binding:"min=-99999999999,max=99999999999"`
	DestinationAmount    int64                          `json:"destinationAmount" binding:"min=-99999999999,max=99999999999"`
	HideAmount           bool                           `json:"hideAmount"`
	TagIds               []string                       `json:"tagIds"`
	Comment              string                         `json:"comment" binding:"max=255"`
	GeoLocation          *TransactionGeoLocationRequest `json:"geoLocation" binding:"omitempty"`
}

TransactionCreateRequest represents all parameters of transaction creation request

type TransactionDbType

type TransactionDbType byte

TransactionDbType represents transaction type in database

const (
	TRANSACTION_DB_TYPE_MODIFY_BALANCE TransactionDbType = 1
	TRANSACTION_DB_TYPE_INCOME         TransactionDbType = 2
	TRANSACTION_DB_TYPE_EXPENSE        TransactionDbType = 3
	TRANSACTION_DB_TYPE_TRANSFER_OUT   TransactionDbType = 4
	TRANSACTION_DB_TYPE_TRANSFER_IN    TransactionDbType = 5
)

Transaction db types

type TransactionDeleteRequest

type TransactionDeleteRequest struct {
	Id int64 `json:"id,string" binding:"required,min=1"`
}

TransactionDeleteRequest represents all parameters of transaction deleting request

type TransactionEditScope

type TransactionEditScope byte

TransactionEditScope represents the scope which transaction can be edited

const (
	TRANSACTION_EDIT_SCOPE_NONE                TransactionEditScope = 0
	TRANSACTION_EDIT_SCOPE_ALL                 TransactionEditScope = 1
	TRANSACTION_EDIT_SCOPE_TODAY_OR_LATER      TransactionEditScope = 2
	TRANSACTION_EDIT_SCOPE_LAST_24H_OR_LATER   TransactionEditScope = 3
	TRANSACTION_EDIT_SCOPE_THIS_WEEK_OR_LATER  TransactionEditScope = 4
	TRANSACTION_EDIT_SCOPE_THIS_MONTH_OR_LATER TransactionEditScope = 5
	TRANSACTION_EDIT_SCOPE_THIS_YEAR_OR_LATER  TransactionEditScope = 6
	TRANSACTION_EDIT_SCOPE_INVALID             TransactionEditScope = 255
)

Editable Transaction Ranges

func (TransactionEditScope) String

func (s TransactionEditScope) String() string

String returns a textual representation of the editable transaction ranges enum

type TransactionGeoLocationRequest

type TransactionGeoLocationRequest struct {
	Latitude  float64 `json:"latitude" binding:"required"`
	Longitude float64 `json:"longitude" binding:"required"`
}

TransactionGeoLocationRequest represents all parameters of transaction geographic location info update request

type TransactionGeoLocationResponse

type TransactionGeoLocationResponse struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

TransactionGeoLocationResponse represents a view-object of transaction geographic location info

type TransactionGetRequest

type TransactionGetRequest struct {
	Id           int64 `form:"id,string" binding:"required,min=1"`
	TrimAccount  bool  `form:"trim_account"`
	TrimCategory bool  `form:"trim_category"`
	TrimTag      bool  `form:"trim_tag"`
}

TransactionGetRequest represents all parameters of transaction getting request

type TransactionInfoPageWrapperResponse

type TransactionInfoPageWrapperResponse struct {
	Items              TransactionInfoResponseSlice `json:"items"`
	NextTimeSequenceId *int64                       `json:"nextTimeSequenceId,string"`
	TotalCount         *int64                       `json:"totalCount,omitempty"`
}

TransactionInfoPageWrapperResponse represents a response of transaction which contains items and next id

type TransactionInfoPageWrapperResponse2

type TransactionInfoPageWrapperResponse2 struct {
	Items      TransactionInfoResponseSlice `json:"items"`
	TotalCount int64                        `json:"totalCount"`
}

TransactionInfoPageWrapperResponse2 represents a response of transaction which contains items and count

type TransactionInfoResponse

type TransactionInfoResponse struct {
	Id                   int64                            `json:"id,string"`
	TimeSequenceId       int64                            `json:"timeSequenceId,string"`
	Type                 TransactionType                  `json:"type"`
	CategoryId           int64                            `json:"categoryId,string"`
	Category             *TransactionCategoryInfoResponse `json:"category,omitempty"`
	Time                 int64                            `json:"time"`
	UtcOffset            int16                            `json:"utcOffset"`
	SourceAccountId      int64                            `json:"sourceAccountId,string"`
	SourceAccount        *AccountInfoResponse             `json:"sourceAccount,omitempty"`
	DestinationAccountId int64                            `json:"destinationAccountId,string,omitempty"`
	DestinationAccount   *AccountInfoResponse             `json:"destinationAccount,omitempty"`
	SourceAmount         int64                            `json:"sourceAmount"`
	DestinationAmount    int64                            `json:"destinationAmount,omitempty"`
	HideAmount           bool                             `json:"hideAmount"`
	TagIds               []string                         `json:"tagIds"`
	Tags                 []*TransactionTagInfoResponse    `json:"tags,omitempty"`
	Comment              string                           `json:"comment"`
	GeoLocation          *TransactionGeoLocationResponse  `json:"geoLocation,omitempty"`
	Editable             bool                             `json:"editable"`
}

TransactionInfoResponse represents a view-object of transaction

type TransactionInfoResponseSlice

type TransactionInfoResponseSlice []*TransactionInfoResponse

TransactionInfoResponseSlice represents the slice data structure of TransactionInfoResponse

func (TransactionInfoResponseSlice) Len

Len returns the count of items

func (TransactionInfoResponseSlice) Less

func (s TransactionInfoResponseSlice) Less(i, j int) bool

Less reports whether the first item is less than the second one

func (TransactionInfoResponseSlice) Swap

func (s TransactionInfoResponseSlice) Swap(i, j int)

Swap swaps two items

type TransactionListByMaxTimeRequest

type TransactionListByMaxTimeRequest struct {
	Type         TransactionDbType `form:"type" binding:"min=0,max=4"`
	CategoryId   int64             `form:"category_id" binding:"min=0"`
	AccountId    int64             `form:"account_id" binding:"min=0"`
	Keyword      string            `form:"keyword"`
	MaxTime      int64             `form:"max_time" binding:"min=0"`
	MinTime      int64             `form:"min_time" binding:"min=0"`
	Page         int32             `form:"page" binding:"min=0"`
	Count        int32             `form:"count" binding:"required,min=1,max=50"`
	WithCount    bool              `form:"with_count"`
	TrimAccount  bool              `form:"trim_account"`
	TrimCategory bool              `form:"trim_category"`
	TrimTag      bool              `form:"trim_tag"`
}

TransactionListByMaxTimeRequest represents all parameters of transaction listing by max time request

type TransactionListInMonthByPageRequest

type TransactionListInMonthByPageRequest struct {
	Year         int32             `form:"year" binding:"required,min=1"`
	Month        int32             `form:"month" binding:"required,min=1"`
	Type         TransactionDbType `form:"type" binding:"min=0,max=4"`
	CategoryId   int64             `form:"category_id" binding:"min=0"`
	AccountId    int64             `form:"account_id" binding:"min=0"`
	Keyword      string            `form:"keyword"`
	TrimAccount  bool              `form:"trim_account"`
	TrimCategory bool              `form:"trim_category"`
	TrimTag      bool              `form:"trim_tag"`
}

TransactionListInMonthByPageRequest represents all parameters of transaction listing by month request

type TransactionModifyRequest

type TransactionModifyRequest struct {
	Id                   int64                          `json:"id,string" binding:"required,min=1"`
	CategoryId           int64                          `json:"categoryId,string"`
	Time                 int64                          `json:"time" binding:"required,min=1"`
	UtcOffset            int16                          `json:"utcOffset" binding:"min=-720,max=840"`
	SourceAccountId      int64                          `json:"sourceAccountId,string" binding:"required,min=1"`
	DestinationAccountId int64                          `json:"destinationAccountId,string" binding:"min=0"`
	SourceAmount         int64                          `json:"sourceAmount" binding:"min=-99999999999,max=99999999999"`
	DestinationAmount    int64                          `json:"destinationAmount" binding:"min=-99999999999,max=99999999999"`
	HideAmount           bool                           `json:"hideAmount"`
	TagIds               []string                       `json:"tagIds"`
	Comment              string                         `json:"comment" binding:"max=255"`
	GeoLocation          *TransactionGeoLocationRequest `json:"geoLocation" binding:"omitempty"`
}

TransactionModifyRequest represents all parameters of transaction modification request

type TransactionMonthAmountsResponseItem

type TransactionMonthAmountsResponseItem struct {
	Year    int32                                       `json:"year"`
	Month   int32                                       `json:"month"`
	Amounts []*TransactionAmountsResponseItemAmountInfo `json:"amounts"`
}

TransactionMonthAmountsResponseItem represents an item of transaction month amounts

type TransactionStatisticRequest

type TransactionStatisticRequest struct {
	StartTime              int64 `form:"start_time" binding:"min=0"`
	EndTime                int64 `form:"end_time" binding:"min=0"`
	UseTransactionTimezone bool  `form:"use_transaction_timezone"`
}

TransactionStatisticRequest represents all parameters of transaction statistic request

type TransactionStatisticResponse

type TransactionStatisticResponse struct {
	StartTime int64                               `json:"startTime"`
	EndTime   int64                               `json:"endTime"`
	Items     []*TransactionStatisticResponseItem `json:"items"`
}

TransactionStatisticResponse represents an item of transaction amounts

type TransactionStatisticResponseItem

type TransactionStatisticResponseItem struct {
	CategoryId  int64 `json:"categoryId,string"`
	AccountId   int64 `json:"accountId,string"`
	TotalAmount int64 `json:"amount"`
}

TransactionStatisticResponseItem represents total amount item for an response

type TransactionTag

type TransactionTag struct {
	TagId           int64  `xorm:"PK"`
	Uid             int64  `xorm:"INDEX(IDX_tag_uid_deleted_name) NOT NULL"`
	Deleted         bool   `xorm:"INDEX(IDX_tag_uid_deleted_name) NOT NULL"`
	Name            string `xorm:"INDEX(IDX_tag_uid_deleted_name) VARCHAR(32) NOT NULL"`
	DisplayOrder    int32  `xorm:"NOT NULL"`
	Hidden          bool   `xorm:"NOT NULL"`
	CreatedUnixTime int64
	UpdatedUnixTime int64
	DeletedUnixTime int64
}

TransactionTag represents transaction tag data stored in database

func (*TransactionTag) ToTransactionTagInfoResponse

func (t *TransactionTag) ToTransactionTagInfoResponse() *TransactionTagInfoResponse

ToTransactionTagInfoResponse returns a view-object according to database model

type TransactionTagCreateRequest

type TransactionTagCreateRequest struct {
	Name string `json:"name" binding:"required,notBlank,max=32"`
}

TransactionTagCreateRequest represents all parameters of transaction tag creation request

type TransactionTagDeleteRequest

type TransactionTagDeleteRequest struct {
	Id int64 `json:"id,string" binding:"required,min=1"`
}

TransactionTagDeleteRequest represents all parameters of transaction tag deleting request

type TransactionTagGetRequest

type TransactionTagGetRequest struct {
	Id int64 `form:"id,string" binding:"required,min=1"`
}

TransactionTagGetRequest represents all parameters of transaction tag getting request

type TransactionTagHideRequest

type TransactionTagHideRequest struct {
	Id     int64 `json:"id,string" binding:"required,min=1"`
	Hidden bool  `json:"hidden"`
}

TransactionTagHideRequest represents all parameters of transaction tag hiding request

type TransactionTagIndex

type TransactionTagIndex struct {
	TagIndexId      int64 `xorm:"PK"`
	Uid             int64 `` /* 202-byte string literal not displayed */
	Deleted         bool  `` /* 211-byte string literal not displayed */
	TagId           int64 `` /* 142-byte string literal not displayed */
	TransactionId   int64 `` /* 133-byte string literal not displayed */
	TransactionTime int64 `xorm:"INDEX(IDX_transaction_tag_index_uid_deleted_tag_id_transaction_time) NOT NULL"`
	CreatedUnixTime int64
	UpdatedUnixTime int64
	DeletedUnixTime int64
}

TransactionTagIndex represents transaction and transaction tag relation stored in database

type TransactionTagInfoResponse

type TransactionTagInfoResponse struct {
	Id           int64  `json:"id,string"`
	Name         string `json:"name"`
	DisplayOrder int32  `json:"displayOrder"`
	Hidden       bool   `json:"hidden"`
}

TransactionTagInfoResponse represents a view-object of transaction tag

type TransactionTagInfoResponseSlice

type TransactionTagInfoResponseSlice []*TransactionTagInfoResponse

TransactionTagInfoResponseSlice represents the slice data structure of TransactionTagInfoResponse

func (TransactionTagInfoResponseSlice) Len

Len returns the count of items

func (TransactionTagInfoResponseSlice) Less

Less reports whether the first item is less than the second one

func (TransactionTagInfoResponseSlice) Swap

func (s TransactionTagInfoResponseSlice) Swap(i, j int)

Swap swaps two items

type TransactionTagModifyRequest

type TransactionTagModifyRequest struct {
	Id   int64  `json:"id,string" binding:"required,min=1"`
	Name string `json:"name" binding:"required,notBlank,max=32"`
}

TransactionTagModifyRequest represents all parameters of transaction tag modification request

type TransactionTagMoveRequest

type TransactionTagMoveRequest struct {
	NewDisplayOrders []*TransactionTagNewDisplayOrderRequest `json:"newDisplayOrders"`
}

TransactionTagMoveRequest represents all parameters of transaction tag moving request

type TransactionTagNewDisplayOrderRequest

type TransactionTagNewDisplayOrderRequest struct {
	Id           int64 `json:"id,string" binding:"required,min=1"`
	DisplayOrder int32 `json:"displayOrder"`
}

TransactionTagNewDisplayOrderRequest represents a data pair of id and display order

type TransactionType

type TransactionType byte

TransactionType represents transaction type

const (
	TRANSACTION_TYPE_MODIFY_BALANCE TransactionType = 1
	TRANSACTION_TYPE_INCOME         TransactionType = 2
	TRANSACTION_TYPE_EXPENSE        TransactionType = 3
	TRANSACTION_TYPE_TRANSFER       TransactionType = 4
)

Transaction types

type TwoFactor

type TwoFactor struct {
	Uid             int64  `xorm:"PK"`
	Secret          string `xorm:"VARCHAR(80) NOT NULL"`
	CreatedUnixTime int64
}

TwoFactor represents user 2fa data stored in database

type TwoFactorDisableRequest

type TwoFactorDisableRequest struct {
	Password string `json:"password" binding:"omitempty,min=6,max=128"`
}

TwoFactorDisableRequest represents all parameters of 2fa disabling request

type TwoFactorEnableConfirmRequest

type TwoFactorEnableConfirmRequest struct {
	Secret   string `json:"secret" binding:"required,notBlank,len=32"`
	Passcode string `json:"passcode" binding:"required,notBlank,len=6"`
}

TwoFactorEnableConfirmRequest represents all parameters of 2fa confirm request

type TwoFactorEnableConfirmResponse

type TwoFactorEnableConfirmResponse struct {
	Token         string   `json:"token,omitempty"`
	RecoveryCodes []string `json:"recoveryCodes"`
}

TwoFactorEnableConfirmResponse represents all response parameters after user have enabled 2fa

type TwoFactorEnableResponse

type TwoFactorEnableResponse struct {
	Secret string `json:"secret"`
	QRCode string `json:"qrcode"`
}

TwoFactorEnableResponse represents all response parameters when user requests to enable 2fa

type TwoFactorLoginRequest

type TwoFactorLoginRequest struct {
	Passcode string `json:"passcode" binding:"required,notBlank,len=6"`
}

TwoFactorLoginRequest represents all parameters of 2fa login request

type TwoFactorRecoveryCode

type TwoFactorRecoveryCode struct {
	Uid             int64  `xorm:"PK"`
	RecoveryCode    string `xorm:"VARCHAR(64) PK"`
	Used            bool   `xorm:"NOT NULL"`
	CreatedUnixTime int64
	UsedUnixTime    int64
}

TwoFactorRecoveryCode represents user 2fa recovery codes stored in database

type TwoFactorRecoveryCodeLoginRequest

type TwoFactorRecoveryCodeLoginRequest struct {
	RecoveryCode string `json:"recoveryCode" binding:"required,notBlank,len=11"`
}

TwoFactorRecoveryCodeLoginRequest represents all parameters of 2fa login request via recovery code

type TwoFactorRegenerateRecoveryCodeRequest

type TwoFactorRegenerateRecoveryCodeRequest struct {
	Password string `json:"password" binding:"omitempty,min=6,max=128"`
}

TwoFactorRegenerateRecoveryCodeRequest represents all parameters of 2fa regenerating recovery codes request

type TwoFactorStatusResponse

type TwoFactorStatusResponse struct {
	Enable    bool  `json:"enable"`
	CreatedAt int64 `json:"createdAt,omitempty"`
}

TwoFactorStatusResponse represents a view-object of 2fa status

type User

type User struct {
	Uid                  int64  `xorm:"PK"`
	Username             string `xorm:"VARCHAR(32) UNIQUE NOT NULL"`
	Email                string `xorm:"VARCHAR(100) UNIQUE NOT NULL"`
	Nickname             string `xorm:"VARCHAR(64) NOT NULL"`
	Password             string `xorm:"VARCHAR(64) NOT NULL"`
	Salt                 string `xorm:"VARCHAR(10) NOT NULL"`
	DefaultAccountId     int64
	TransactionEditScope TransactionEditScope `xorm:"TINYINT NOT NULL"`
	Language             string               `xorm:"VARCHAR(10)"`
	DefaultCurrency      string               `xorm:"VARCHAR(3) NOT NULL"`
	FirstDayOfWeek       WeekDay              `xorm:"TINYINT NOT NULL"`
	LongDateFormat       LongDateFormat       `xorm:"TINYINT"`
	ShortDateFormat      ShortDateFormat      `xorm:"TINYINT"`
	LongTimeFormat       LongTimeFormat       `xorm:"TINYINT"`
	ShortTimeFormat      ShortTimeFormat      `xorm:"TINYINT"`
	Disabled             bool
	Deleted              bool `xorm:"NOT NULL"`
	EmailVerified        bool `xorm:"NOT NULL"`
	CreatedUnixTime      int64
	UpdatedUnixTime      int64
	DeletedUnixTime      int64
	LastLoginUnixTime    int64
}

User represents user data stored in database

func (*User) CanEditTransactionByTransactionTime

func (u *User) CanEditTransactionByTransactionTime(transactionTime int64, utcOffset int16) bool

CanEditTransactionByTransactionTime returns whether this user can edit transaction with specified transaction time

func (*User) ToUserBasicInfo

func (u *User) ToUserBasicInfo() *UserBasicInfo

ToUserBasicInfo returns a user basic view-object according to database model

func (*User) ToUserProfileResponse

func (u *User) ToUserProfileResponse() *UserProfileResponse

ToUserProfileResponse returns a user profile view-object according to database model

type UserBasicInfo

type UserBasicInfo struct {
	Username             string               `json:"username"`
	Email                string               `json:"email"`
	Nickname             string               `json:"nickname"`
	AvatarUrl            string               `json:"avatar"`
	AvatarProvider       string               `json:"avatarProvider,omitempty"`
	DefaultAccountId     int64                `json:"defaultAccountId,string"`
	TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
	Language             string               `json:"language"`
	DefaultCurrency      string               `json:"defaultCurrency"`
	FirstDayOfWeek       WeekDay              `json:"firstDayOfWeek"`
	LongDateFormat       LongDateFormat       `json:"longDateFormat"`
	ShortDateFormat      ShortDateFormat      `json:"shortDateFormat"`
	LongTimeFormat       LongTimeFormat       `json:"longTimeFormat"`
	ShortTimeFormat      ShortTimeFormat      `json:"shortTimeFormat"`
	EmailVerified        bool                 `json:"emailVerified"`
}

UserBasicInfo represents a view-object of user basic info

type UserLoginRequest

type UserLoginRequest struct {
	LoginName string `json:"loginName" binding:"required,notBlank,max=100,validUsername|validEmail"`
	Password  string `json:"password" binding:"required,min=6,max=128"`
}

UserLoginRequest represents all parameters of user login request

type UserProfileResponse

type UserProfileResponse struct {
	Username             string               `json:"username"`
	Email                string               `json:"email"`
	Nickname             string               `json:"nickname"`
	AvatarUrl            string               `json:"avatar"`
	AvatarProvider       string               `json:"avatarProvider,omitempty"`
	DefaultAccountId     int64                `json:"defaultAccountId,string"`
	TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
	Language             string               `json:"language"`
	DefaultCurrency      string               `json:"defaultCurrency"`
	FirstDayOfWeek       WeekDay              `json:"firstDayOfWeek"`
	LongDateFormat       LongDateFormat       `json:"longDateFormat"`
	ShortDateFormat      ShortDateFormat      `json:"shortDateFormat"`
	LongTimeFormat       LongTimeFormat       `json:"longTimeFormat"`
	ShortTimeFormat      ShortTimeFormat      `json:"shortTimeFormat"`
	EmailVerified        bool                 `json:"emailVerified"`
	LastLoginAt          int64                `json:"lastLoginAt"`
}

UserProfileResponse represents a view-object of user profile

type UserProfileUpdateRequest

type UserProfileUpdateRequest struct {
	Email                string                `json:"email" binding:"omitempty,notBlank,max=100,validEmail"`
	Nickname             string                `json:"nickname" binding:"omitempty,notBlank,max=64"`
	Password             string                `json:"password" binding:"omitempty,min=6,max=128"`
	OldPassword          string                `json:"oldPassword" binding:"omitempty,min=6,max=128"`
	DefaultAccountId     int64                 `json:"defaultAccountId,string" binding:"omitempty,min=1"`
	TransactionEditScope *TransactionEditScope `json:"transactionEditScope" binding:"omitempty,min=0,max=7"`
	Language             string                `json:"language" binding:"omitempty,min=2,max=16"`
	DefaultCurrency      string                `json:"defaultCurrency" binding:"omitempty,len=3,validCurrency"`
	FirstDayOfWeek       *WeekDay              `json:"firstDayOfWeek" binding:"omitempty,min=0,max=6"`
	LongDateFormat       *LongDateFormat       `json:"longDateFormat" binding:"omitempty,min=0,max=3"`
	ShortDateFormat      *ShortDateFormat      `json:"shortDateFormat" binding:"omitempty,min=0,max=3"`
	LongTimeFormat       *LongTimeFormat       `json:"longTimeFormat" binding:"omitempty,min=0,max=3"`
	ShortTimeFormat      *ShortTimeFormat      `json:"shortTimeFormat" binding:"omitempty,min=0,max=3"`
}

UserProfileUpdateRequest represents all parameters of user updating profile request

type UserProfileUpdateResponse

type UserProfileUpdateResponse struct {
	User     *UserBasicInfo `json:"user"`
	NewToken string         `json:"newToken,omitempty"`
}

UserProfileUpdateResponse represents the data returns to frontend after updating profile

type UserRegisterRequest

type UserRegisterRequest struct {
	Username        string  `json:"username" binding:"required,notBlank,max=32,validUsername"`
	Email           string  `json:"email" binding:"required,notBlank,max=100,validEmail"`
	Nickname        string  `json:"nickname" binding:"required,notBlank,max=64"`
	Password        string  `json:"password" binding:"required,min=6,max=128"`
	Language        string  `json:"language" binding:"required,min=2,max=16"`
	DefaultCurrency string  `json:"defaultCurrency" binding:"required,len=3,validCurrency"`
	FirstDayOfWeek  WeekDay `json:"firstDayOfWeek" binding:"min=0,max=6"`
	TransactionCategoryCreateBatchRequest
}

UserRegisterRequest represents all parameters of user registering request

type UserResendVerifyEmailRequest

type UserResendVerifyEmailRequest struct {
	Email    string `json:"email" binding:"omitempty,max=100,validEmail"`
	Password string `json:"password" binding:"omitempty,min=6,max=128"`
}

UserResendVerifyEmailRequest represents all parameters of user resend verify email request

type UserVerifyEmailRequest

type UserVerifyEmailRequest struct {
	RequestNewToken bool `json:"requestNewToken" binding:"omitempty"`
}

UserVerifyEmailRequest represents all parameters of user verify email request

type UserVerifyEmailResponse

type UserVerifyEmailResponse struct {
	NewToken string         `json:"newToken,omitempty"`
	User     *UserBasicInfo `json:"user"`
}

UserVerifyEmailResponse represents all response parameters after user have verified email

type WeekDay

type WeekDay byte

WeekDay represents week day

const (
	WEEKDAY_SUNDAY    WeekDay = 0
	WEEKDAY_MONDAY    WeekDay = 1
	WEEKDAY_TUESDAY   WeekDay = 2
	WEEKDAY_WEDNESDAY WeekDay = 3
	WEEKDAY_THURSDAY  WeekDay = 4
	WEEKDAY_FRIDAY    WeekDay = 5
	WEEKDAY_SATURDAY  WeekDay = 6
	WEEKDAY_INVALID   WeekDay = 255
)

Week days

func (WeekDay) String

func (d WeekDay) String() string

String returns a textual representation of the week day enum

type YearMonthRangeRequest

type YearMonthRangeRequest struct {
	StartYearMonth string `form:"start_year_month"`
	EndYearMonth   string `form:"end_year_month"`
}

YearMonthRangeRequest represents all parameters of a request with year and month range

func (*YearMonthRangeRequest) GetStartTimeAndEndTime

func (t *YearMonthRangeRequest) GetStartTimeAndEndTime(utcOffset int16) (int64, int64, error)

GetStartTimeAndEndTime returns start unix time and end unix time by request parameter

Jump to

Keyboard shortcuts

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