show timezone in transaction list page if the timezone of transaction does not equal with client current timezone

This commit is contained in:
MaysWind
2021-03-13 21:17:37 +08:00
parent ac27a6f7f9
commit 149f29f8a5
4 changed files with 42 additions and 8 deletions
+3
View File
@@ -34,6 +34,7 @@ type Transaction struct {
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 `xorm:"UNIQUE(UQE_transaction_uid_time) INDEX(IDX_transaction_uid_deleted_time) INDEX(IDX_transaction_uid_deleted_type_time) INDEX(IDX_transaction_uid_deleted_category_id_time) INDEX(IDX_transaction_uid_deleted_account_id_time) NOT NULL"`
TimezoneUtcOffset int16 `xorm:"NOT NULL"`
Amount int64 `xorm:"NOT NULL"`
RelatedId int64 `xorm:"NOT NULL"`
RelatedAccountId int64 `xorm:"NOT NULL"`
@@ -119,6 +120,7 @@ type TransactionInfoResponse struct {
Type TransactionType `json:"type"`
CategoryId int64 `json:"categoryId,string"`
Time int64 `json:"time"`
UtcOffset int16 `json:"utcOffset"`
SourceAccountId int64 `json:"sourceAccountId,string"`
DestinationAccountId int64 `json:"destinationAccountId,string,omitempty"`
SourceAmount int64 `json:"sourceAmount"`
@@ -194,6 +196,7 @@ func (t *Transaction) ToTransactionInfoResponse(tagIds []int64, editable bool) *
Type: transactionType,
CategoryId: t.CategoryId,
Time: utils.GetUnixTimeFromTransactionTime(t.TransactionTime),
UtcOffset: t.TimezoneUtcOffset,
SourceAccountId: sourceAccountId,
DestinationAccountId: destinationAccountId,
SourceAmount: sourceAmount,