code refactor, aggregate month total count in list/by_month api

This commit is contained in:
MaysWind
2021-03-28 18:03:17 +08:00
parent 841f275668
commit a07c775aa7
3 changed files with 139 additions and 191 deletions
+7 -1
View File
@@ -155,7 +155,7 @@ type TransactionInfoResponse struct {
// TransactionCountResponse represents transaction count response
type TransactionCountResponse struct {
Count int64 `json:"count"`
Count int64 `json:"count"`
}
// TransactionInfoPageWrapperResponse represents a response of transaction which contains items and next id
@@ -164,6 +164,12 @@ type TransactionInfoPageWrapperResponse struct {
NextTimeSequenceId *int64 `json:"nextTimeSequenceId,string"`
}
// TransactionInfoPageWrapperResponse2 represents a response of transaction which contains items and count
type TransactionInfoPageWrapperResponse2 struct {
Items TransactionInfoResponseSlice `json:"items"`
TotalCount int64 `json:"total_count"`
}
// 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) {