limit the count of tags in transaction template
This commit is contained in:
@@ -140,6 +140,10 @@ func (a *TransactionTemplatesApi) TemplateCreateHandler(c *core.WebContext) (any
|
||||
}
|
||||
}
|
||||
|
||||
if len(templateCreateReq.TagIds) > 10 {
|
||||
return nil, errs.ErrTransactionTemplateHasTooManyTags
|
||||
}
|
||||
|
||||
uid := c.GetCurrentUid()
|
||||
|
||||
maxOrderId, err := a.templates.GetMaxDisplayOrder(c, uid, templateCreateReq.TemplateType)
|
||||
@@ -230,6 +234,10 @@ func (a *TransactionTemplatesApi) TemplateModifyHandler(c *core.WebContext) (any
|
||||
}
|
||||
}
|
||||
|
||||
if len(templateModifyReq.TagIds) > 10 {
|
||||
return nil, errs.ErrTransactionTemplateHasTooManyTags
|
||||
}
|
||||
|
||||
newTemplate := &models.TransactionTemplate{
|
||||
TemplateId: template.TemplateId,
|
||||
Uid: uid,
|
||||
|
||||
@@ -9,4 +9,5 @@ var (
|
||||
ErrTransactionTemplateTypeInvalid = NewNormalError(NormalSubcategoryTemplate, 2, http.StatusBadRequest, "transaction template type is invalid")
|
||||
ErrScheduledTransactionNotEnabled = NewNormalError(NormalSubcategoryTemplate, 3, http.StatusBadRequest, "scheduled transaction is not enabled")
|
||||
ErrScheduledTransactionFrequencyInvalid = NewNormalError(NormalSubcategoryTemplate, 4, http.StatusBadRequest, "scheduled transaction frequency is invalid")
|
||||
ErrTransactionTemplateHasTooManyTags = NewNormalError(NormalSubcategoryTemplate, 5, http.StatusBadRequest, "transaction template has too many tags")
|
||||
)
|
||||
|
||||
@@ -1087,6 +1087,7 @@
|
||||
"transaction template type is invalid": "Transaction template type is invalid",
|
||||
"scheduled transaction is not enabled": "Scheduled transaction is not enabled",
|
||||
"scheduled transaction frequency is invalid": "Scheduled transaction frequency is invalid",
|
||||
"transaction template has too many tags": "There are too many tags in this transaction template",
|
||||
"query items cannot be blank": "There are no query items",
|
||||
"query items too much": "There are too many query items",
|
||||
"query items have invalid item": "There is invalid item in query items",
|
||||
|
||||
@@ -1087,6 +1087,7 @@
|
||||
"transaction template type is invalid": "交易模板类型无效",
|
||||
"scheduled transaction is not enabled": "定时交易没有启用",
|
||||
"scheduled transaction frequency is invalid": "定时交易周期无效",
|
||||
"transaction template has too many tags": "交易模板中的标签过多",
|
||||
"query items cannot be blank": "请求项目不能为空",
|
||||
"query items too much": "请求项目过多",
|
||||
"query items have invalid item": "请求项目中有非法项目",
|
||||
|
||||
Reference in New Issue
Block a user