code refactor
This commit is contained in:
@@ -119,6 +119,12 @@ type TransactionListInMonthByPageRequest struct {
|
||||
TrimTag bool `form:"trim_tag"`
|
||||
}
|
||||
|
||||
// TransactionStatisticRequest represents all parameters of transaction statistic request
|
||||
type TransactionStatisticRequest struct {
|
||||
StartTime int64 `form:"start_time" binding:"min=0"`
|
||||
EndTime int64 `form:"end_time" binding:"min=0"`
|
||||
}
|
||||
|
||||
// TransactionGetRequest represents all parameters of transaction getting request
|
||||
type TransactionGetRequest struct {
|
||||
Id int64 `form:"id,string" binding:"required,min=1"`
|
||||
@@ -170,6 +176,20 @@ type TransactionInfoPageWrapperResponse2 struct {
|
||||
TotalCount int64 `json:"total_count"`
|
||||
}
|
||||
|
||||
// TransactionStatisticResponse represents an item of transaction overview
|
||||
type TransactionStatisticResponse struct {
|
||||
StartTime int64 `json:"startTime"`
|
||||
EndTime int64 `json:"endTime"`
|
||||
Items []*TransactionStatisticResponseItem `json:"items"`
|
||||
}
|
||||
|
||||
// TransactionStatisticResponseItem represents total amount item for an response
|
||||
type TransactionStatisticResponseItem struct {
|
||||
CategoryId int64 `json:"categoryId,string"`
|
||||
AccountId int64 `json:"accountId,string"`
|
||||
TotalAmount int64 `json:"amount"`
|
||||
}
|
||||
|
||||
// IsEditable returns whether this transaction can be edited
|
||||
func (t *Transaction) IsEditable(currentUser *User, utcOffset int16, account *Account, relatedAccount *Account) bool {
|
||||
if currentUser == nil || !currentUser.CanEditTransactionByTransactionTime(t.TransactionTime, utcOffset) {
|
||||
|
||||
Reference in New Issue
Block a user