mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-27 01:51:56 +08:00
Feat: unit test coverage report
This commit is contained in:
@@ -35,3 +35,18 @@ func Move(c *gin.Context) {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
// Copy 复制文件或目录
|
||||
func Copy(c *gin.Context) {
|
||||
// 创建上下文
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var service explorer.ItemMoveService
|
||||
if err := c.ShouldBindJSON(&service); err == nil {
|
||||
res := service.Copy(ctx, c)
|
||||
c.JSON(200, res)
|
||||
} else {
|
||||
c.JSON(200, ErrorResponse(err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,10 @@ func InitRouter() *gin.Engine {
|
||||
{
|
||||
// 删除对象
|
||||
object.DELETE("", controllers.Delete)
|
||||
// 移动对象
|
||||
object.PATCH("", controllers.Move)
|
||||
// 复制对象
|
||||
object.POST("copy", controllers.Copy)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user