limit maximum count of tags in a transaction
This commit is contained in:
@@ -646,6 +646,10 @@ func (a *TransactionsApi) TransactionCreateHandler(c *core.WebContext) (any, *er
|
|||||||
return nil, errs.ErrTransactionTagIdInvalid
|
return nil, errs.ErrTransactionTagIdInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(tagIds) > 10 {
|
||||||
|
return nil, errs.ErrTransactionTagTooMuch
|
||||||
|
}
|
||||||
|
|
||||||
pictureIds, err := utils.StringArrayToInt64Array(transactionCreateReq.PictureIds)
|
pictureIds, err := utils.StringArrayToInt64Array(transactionCreateReq.PictureIds)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -772,6 +776,10 @@ func (a *TransactionsApi) TransactionModifyHandler(c *core.WebContext) (any, *er
|
|||||||
return nil, errs.ErrTransactionTagIdInvalid
|
return nil, errs.ErrTransactionTagIdInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(tagIds) > 10 {
|
||||||
|
return nil, errs.ErrTransactionTagTooMuch
|
||||||
|
}
|
||||||
|
|
||||||
pictureIds, err := utils.StringArrayToInt64Array(transactionModifyReq.PictureIds)
|
pictureIds, err := utils.StringArrayToInt64Array(transactionModifyReq.PictureIds)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ var (
|
|||||||
ErrTransactionTagNameAlreadyExists = NewNormalError(NormalSubcategoryTag, 3, http.StatusBadRequest, "transaction tag name already exists")
|
ErrTransactionTagNameAlreadyExists = NewNormalError(NormalSubcategoryTag, 3, http.StatusBadRequest, "transaction tag name already exists")
|
||||||
ErrTransactionTagInUseCannotBeDeleted = NewNormalError(NormalSubcategoryTag, 4, http.StatusBadRequest, "transaction tag is in use and cannot be deleted")
|
ErrTransactionTagInUseCannotBeDeleted = NewNormalError(NormalSubcategoryTag, 4, http.StatusBadRequest, "transaction tag is in use and cannot be deleted")
|
||||||
ErrTransactionTagIndexNotFound = NewNormalError(NormalSubcategoryTag, 5, http.StatusBadRequest, "transaction tag index not found")
|
ErrTransactionTagIndexNotFound = NewNormalError(NormalSubcategoryTag, 5, http.StatusBadRequest, "transaction tag index not found")
|
||||||
|
ErrTransactionTagTooMuch = NewNormalError(NormalSubcategoryTag, 6, http.StatusBadRequest, "transaction tags too much")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@
|
|||||||
"transaction tag name already exists": "Transaction tag title already exists",
|
"transaction tag name already exists": "Transaction tag title already exists",
|
||||||
"transaction tag is in use and cannot be deleted": "Transaction tag is in use and it cannot be deleted",
|
"transaction tag is in use and cannot be deleted": "Transaction tag is in use and it cannot be deleted",
|
||||||
"transaction tag index not found": "Transaction tag index is not found",
|
"transaction tag index not found": "Transaction tag index is not found",
|
||||||
|
"transaction tags too much": "There are too many transaction tags",
|
||||||
"data export not allowed": "User data export is not allowed",
|
"data export not allowed": "User data export is not allowed",
|
||||||
"transaction template id is invalid": "Transaction template ID is invalid",
|
"transaction template id is invalid": "Transaction template ID is invalid",
|
||||||
"transaction template not found": "Transaction template is not found",
|
"transaction template not found": "Transaction template is not found",
|
||||||
|
|||||||
@@ -1081,6 +1081,7 @@
|
|||||||
"transaction tag name already exists": "交易标签标题已经存在",
|
"transaction tag name already exists": "交易标签标题已经存在",
|
||||||
"transaction tag is in use and cannot be deleted": "交易标签正在被使用,无法删除",
|
"transaction tag is in use and cannot be deleted": "交易标签正在被使用,无法删除",
|
||||||
"transaction tag index not found": "交易标签索引不存在",
|
"transaction tag index not found": "交易标签索引不存在",
|
||||||
|
"transaction tags too much": "交易标签过多",
|
||||||
"data export not allowed": "不允许用户数据导出",
|
"data export not allowed": "不允许用户数据导出",
|
||||||
"transaction template id is invalid": "交易模板ID无效",
|
"transaction template id is invalid": "交易模板ID无效",
|
||||||
"transaction template not found": "交易模板不存在",
|
"transaction template not found": "交易模板不存在",
|
||||||
|
|||||||
Reference in New Issue
Block a user