Feat: create empty file in web panel (#305)

This commit is contained in:
HFO4
2020-05-09 10:35:18 +08:00
parent ee0f224cbb
commit 58856612e2
4 changed files with 51 additions and 2 deletions

View File

@@ -353,3 +353,14 @@ func SearchFile(c *gin.Context) {
c.JSON(200, ErrorResponse(err))
}
}
// CreateFile 创建空白文件
func CreateFile(c *gin.Context) {
var service explorer.SingleFileService
if err := c.ShouldBindJSON(&service); err == nil {
res := service.Create(c)
c.JSON(200, res)
} else {
c.JSON(200, ErrorResponse(err))
}
}

View File

@@ -445,6 +445,8 @@ func InitMasterRouter() *gin.Engine {
file.GET("upload/credential", controllers.GetUploadCredential)
// 更新文件
file.PUT("update/:id", controllers.PutContent)
// 创建空白文件
file.POST("create", controllers.CreateFile)
// 创建文件下载会话
file.PUT("download/:id", controllers.CreateDownloadSession)
// 预览文件