Feat: add and delete file tags

This commit is contained in:
HFO4
2020-02-12 11:38:04 +08:00
parent 127d0236f9
commit 15f4b1819b
10 changed files with 246 additions and 3 deletions

View File

@@ -0,0 +1,39 @@
package controllers
import (
"github.com/HFO4/cloudreve/service/explorer"
"github.com/gin-gonic/gin"
)
// CreateFilterTag 创建文件分类标签
func CreateFilterTag(c *gin.Context) {
var service explorer.FilterTagCreateService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Create(c, CurrentUser(c))
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
// CreateLinkTag 创建目录快捷方式标签
func CreateLinkTag(c *gin.Context) {
var service explorer.LinkTagCreateService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Create(c, CurrentUser(c))
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
// DeleteTag 删除标签
func DeleteTag(c *gin.Context) {
var service explorer.TagService
if err := c.ShouldBindUri(&service); err == nil {
res := service.Delete(c, CurrentUser(c))
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}