From e532f372b5b24f9d9bf64f611cb8fb5741ed4fba Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 13 Aug 2024 22:57:21 +0800 Subject: [PATCH] code refactor --- pkg/models/account.go | 2 +- pkg/models/transaction_category.go | 2 +- pkg/models/transaction_tag.go | 2 +- pkg/models/transaction_template.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/models/account.go b/pkg/models/account.go index fe54c482..76dee610 100644 --- a/pkg/models/account.go +++ b/pkg/models/account.go @@ -111,7 +111,7 @@ type AccountHideRequest struct { // AccountMoveRequest represents all parameters of account moving request type AccountMoveRequest struct { - NewDisplayOrders []*AccountNewDisplayOrderRequest `json:"newDisplayOrders"` + NewDisplayOrders []*AccountNewDisplayOrderRequest `json:"newDisplayOrders" binding:"required,min=1"` } // AccountNewDisplayOrderRequest represents a data pair of id and display order diff --git a/pkg/models/transaction_category.go b/pkg/models/transaction_category.go index fedca128..34f7d895 100644 --- a/pkg/models/transaction_category.go +++ b/pkg/models/transaction_category.go @@ -87,7 +87,7 @@ type TransactionCategoryHideRequest struct { // TransactionCategoryMoveRequest represents all parameters of transaction category moving request type TransactionCategoryMoveRequest struct { - NewDisplayOrders []*TransactionCategoryNewDisplayOrderRequest `json:"newDisplayOrders"` + NewDisplayOrders []*TransactionCategoryNewDisplayOrderRequest `json:"newDisplayOrders" binding:"required,min=1"` } // TransactionCategoryNewDisplayOrderRequest represents a data pair of id and display order diff --git a/pkg/models/transaction_tag.go b/pkg/models/transaction_tag.go index 2b53b1fb..654905dc 100644 --- a/pkg/models/transaction_tag.go +++ b/pkg/models/transaction_tag.go @@ -37,7 +37,7 @@ type TransactionTagHideRequest struct { // TransactionTagMoveRequest represents all parameters of transaction tag moving request type TransactionTagMoveRequest struct { - NewDisplayOrders []*TransactionTagNewDisplayOrderRequest `json:"newDisplayOrders"` + NewDisplayOrders []*TransactionTagNewDisplayOrderRequest `json:"newDisplayOrders" binding:"required,min=1"` } // TransactionTagNewDisplayOrderRequest represents a data pair of id and display order diff --git a/pkg/models/transaction_template.go b/pkg/models/transaction_template.go index 50d66bd1..b3c71a7c 100644 --- a/pkg/models/transaction_template.go +++ b/pkg/models/transaction_template.go @@ -92,7 +92,7 @@ type TransactionTemplateHideRequest struct { // TransactionTemplateMoveRequest represents all parameters of transaction template moving request type TransactionTemplateMoveRequest struct { - NewDisplayOrders []*TransactionTemplateNewDisplayOrderRequest `json:"newDisplayOrders"` + NewDisplayOrders []*TransactionTemplateNewDisplayOrderRequest `json:"newDisplayOrders" binding:"required,min=1"` } // TransactionTemplateNewDisplayOrderRequest represents a data pair of id and display order