Feat: rename file

This commit is contained in:
HFO4 committed 2019-12-07 15:54:07 +08:00
1 parent f4c414c0f6
commit 10a2ef4267
7 files changed
+83 -4

No files matched your search

+15
View File
@@ -50,3 +50,18 @@ func Copy(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// Rename 重命名文件或目录
func Rename(c *gin.Context) {
// 创建上下文
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var service explorer.ItemRenameService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Rename(ctx, c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}
+2
View File
@@ -87,6 +87,8 @@ func InitRouter() *gin.Engine {
object.PATCH("", controllers.Move)
// 复制对象
object.POST("copy", controllers.Copy)
// 重命名对象
object.POST("rename", controllers.Rename)
}
}