Feat: unit test coverage report

This commit is contained in:
HFO4
2019-12-03 14:20:23 +08:00
parent 5424115e51
commit c09fc535dc
6 changed files with 168 additions and 24 deletions

View File

@@ -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))
}
}

View File

@@ -80,7 +80,10 @@ func InitRouter() *gin.Engine {
{
// 删除对象
object.DELETE("", controllers.Delete)
// 移动对象
object.PATCH("", controllers.Move)
// 复制对象
object.POST("copy", controllers.Copy)
}
}