mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 18:24:26 +08:00
modify field definition
This commit is contained in:
@@ -70,7 +70,7 @@ func (a *TransactionsApi) TransactionListHandler(c *core.Context) (interface{},
|
|||||||
sort.Sort(transactionResps.Items)
|
sort.Sort(transactionResps.Items)
|
||||||
|
|
||||||
if finalCount < len(transactions) {
|
if finalCount < len(transactions) {
|
||||||
transactionResps.NextTime = &transactions[finalCount].TransactionTime
|
transactionResps.NextTimeSequenceId = &transactions[finalCount].TransactionTime
|
||||||
}
|
}
|
||||||
|
|
||||||
return transactionResps, nil
|
return transactionResps, nil
|
||||||
@@ -285,7 +285,7 @@ func (a *TransactionsApi) createNewTransactionModel(uid int64, transactionCreate
|
|||||||
Uid: uid,
|
Uid: uid,
|
||||||
Type: transactionCreateReq.Type,
|
Type: transactionCreateReq.Type,
|
||||||
CategoryId: transactionCreateReq.CategoryId,
|
CategoryId: transactionCreateReq.CategoryId,
|
||||||
TransactionTime: transactionCreateReq.Time,
|
TransactionTime: utils.GetMinTransactionTimeFromUnixTime(transactionCreateReq.Time),
|
||||||
SourceAccountId: transactionCreateReq.SourceAccountId,
|
SourceAccountId: transactionCreateReq.SourceAccountId,
|
||||||
DestinationAccountId: transactionCreateReq.DestinationAccountId,
|
DestinationAccountId: transactionCreateReq.DestinationAccountId,
|
||||||
SourceAmount: transactionCreateReq.SourceAmount,
|
SourceAmount: transactionCreateReq.SourceAmount,
|
||||||
|
|||||||
+16
-12
@@ -1,5 +1,7 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
|
import "github.com/mayswind/lab/pkg/utils"
|
||||||
|
|
||||||
type TransactionType byte
|
type TransactionType byte
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -39,15 +41,15 @@ type TransactionCreateRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TransactionModifyRequest struct {
|
type TransactionModifyRequest struct {
|
||||||
Id int64 `json:"id,string" binding:"required,min=1"`
|
Id int64 `json:"id,string" binding:"required,min=1"`
|
||||||
CategoryId int64 `json:"categoryId,string"`
|
CategoryId int64 `json:"categoryId,string"`
|
||||||
Time int64 `json:"time" binding:"required,min=1"`
|
Time int64 `json:"time" binding:"required,min=1"`
|
||||||
SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"`
|
SourceAccountId int64 `json:"sourceAccountId,string" binding:"required,min=1"`
|
||||||
DestinationAccountId int64 `json:"destinationAccountId,string" binding:"required,min=1"`
|
DestinationAccountId int64 `json:"destinationAccountId,string" binding:"required,min=1"`
|
||||||
SourceAmount int64 `json:"sourceAmount"`
|
SourceAmount int64 `json:"sourceAmount"`
|
||||||
DestinationAmount int64 `json:"destinationAmount"`
|
DestinationAmount int64 `json:"destinationAmount"`
|
||||||
TagIds []int64 `json:"tagIds,string"`
|
TagIds []int64 `json:"tagIds,string"`
|
||||||
Comment string `json:"comment" binding:"max=255"`
|
Comment string `json:"comment" binding:"max=255"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransactionListByMaxTimeRequest struct {
|
type TransactionListByMaxTimeRequest struct {
|
||||||
@@ -72,6 +74,7 @@ type TransactionDeleteRequest struct {
|
|||||||
|
|
||||||
type TransactionInfoResponse struct {
|
type TransactionInfoResponse struct {
|
||||||
Id int64 `json:"id,string"`
|
Id int64 `json:"id,string"`
|
||||||
|
TimeSequenceId int64 `json:"timeSequenceId,string"`
|
||||||
Type TransactionType `json:"type"`
|
Type TransactionType `json:"type"`
|
||||||
CategoryId int64 `json:"categoryId,string"`
|
CategoryId int64 `json:"categoryId,string"`
|
||||||
Time int64 `json:"time"`
|
Time int64 `json:"time"`
|
||||||
@@ -84,16 +87,17 @@ type TransactionInfoResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TransactionInfoPageWrapperResponse struct {
|
type TransactionInfoPageWrapperResponse struct {
|
||||||
Items TransactionInfoResponseSlice `json:"items"`
|
Items TransactionInfoResponseSlice `json:"items"`
|
||||||
NextTime *int64 `json:"nextTime,string"`
|
NextTimeSequenceId *int64 `json:"nextTimeSequenceId,string"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Transaction) ToTransactionInfoResponse(tagIds []int64) *TransactionInfoResponse {
|
func (c *Transaction) ToTransactionInfoResponse(tagIds []int64) *TransactionInfoResponse {
|
||||||
return &TransactionInfoResponse{
|
return &TransactionInfoResponse{
|
||||||
Id: c.TransactionId,
|
Id: c.TransactionId,
|
||||||
|
TimeSequenceId: c.TransactionTime,
|
||||||
Type: c.Type,
|
Type: c.Type,
|
||||||
CategoryId: c.CategoryId,
|
CategoryId: c.CategoryId,
|
||||||
Time: c.TransactionTime,
|
Time: utils.GetUnixTimeFromTransactionTime(c.TransactionTime),
|
||||||
SourceAccountId: c.SourceAccountId,
|
SourceAccountId: c.SourceAccountId,
|
||||||
DestinationAccountId: c.DestinationAccountId,
|
DestinationAccountId: c.DestinationAccountId,
|
||||||
SourceAmount: c.SourceAmount,
|
SourceAmount: c.SourceAmount,
|
||||||
|
|||||||
Reference in New Issue
Block a user