Feat: move files/directories

This commit is contained in:
HFO4
2019-12-01 18:31:29 +08:00
parent 081c92067f
commit fd02425547
9 changed files with 189 additions and 14 deletions

View File

@@ -20,3 +20,18 @@ func Delete(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// Move 移动文件或目录
func Move(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.ItemMoveService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Move(ctx, c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}

View File

@@ -78,7 +78,9 @@ func InitRouter() *gin.Engine {
// 对象,文件和目录的抽象
object := auth.Group("object")
{
// 删除对象
object.DELETE("", controllers.Delete)
object.PATCH("", controllers.Move)
}
}