feat(token): 添加备注功能和相关接口
All checks were successful
构建Docker镜像 / build-and-deploy (push) Successful in 1m41s

This commit is contained in:
2025-09-06 17:43:20 +08:00
parent 333882c9e0
commit b6ce840400
3 changed files with 57 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ func CreateTokenHandler(c *gin.Context) {
Token string `form:"token" binding:"required"`
DedupObject string `form:"dedup_object" binding:"required"`
DataFormat string `form:"data_format" binding:"required"`
Notes string `form:"notes" binding:"required"`
}{}
if err := c.ShouldBindQuery(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "参数不能为空 " + err.Error()})
@@ -25,7 +26,7 @@ func CreateTokenHandler(c *gin.Context) {
}
//创建Token
err := db.CreateToken(input.Token, input.DedupObject, input.DataFormat)
err := db.CreateToken(input.Token, input.DedupObject, input.DataFormat, input.Notes)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
@@ -40,13 +41,14 @@ func UpdateTokenHandler(c *gin.Context) {
Token string `form:"token" binding:"required"`
DedupObject string `form:"dedup_object" binding:"required"`
DataFormat string `form:"data_format" binding:"required"`
Notes string `form:"notes" binding:"required"`
}{}
if err := c.ShouldBindQuery(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "参数不能为空 " + err.Error()})
return
}
err := db.UpdateToken(input.Token, input.DedupObject, input.DataFormat)
err := db.UpdateToken(input.Token, input.DedupObject, input.DataFormat, input.Notes)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return