code refactor

This commit is contained in:
MaysWind
2024-09-01 00:40:49 +08:00
parent 09ddf53b01
commit 4e365f54af
10 changed files with 25 additions and 18 deletions
+4 -2
View File
@@ -15,6 +15,8 @@ import (
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
const maximumTagsCountOfTemplate = 10
// TransactionTemplatesApi represents transaction template api
type TransactionTemplatesApi struct {
ApiUsingConfig
@@ -140,7 +142,7 @@ func (a *TransactionTemplatesApi) TemplateCreateHandler(c *core.WebContext) (any
}
}
if len(templateCreateReq.TagIds) > 10 {
if len(templateCreateReq.TagIds) > maximumTagsCountOfTemplate {
return nil, errs.ErrTransactionTemplateHasTooManyTags
}
@@ -234,7 +236,7 @@ func (a *TransactionTemplatesApi) TemplateModifyHandler(c *core.WebContext) (any
}
}
if len(templateModifyReq.TagIds) > 10 {
if len(templateModifyReq.TagIds) > maximumTagsCountOfTemplate {
return nil, errs.ErrTransactionTemplateHasTooManyTags
}