82 lines
2.3 KiB
Go
82 lines
2.3 KiB
Go
package router
|
|
|
|
import (
|
|
"octopus/internal/schema"
|
|
|
|
"github.com/neo-f/soda"
|
|
)
|
|
|
|
func RegisterDocRouter(app *soda.Soda) {
|
|
app.Get("/docs", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("获取文档列表").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.ListDocQuery{}).
|
|
AddJSONResponse(200, schema.DocList{}).OK()
|
|
|
|
app.Post("/docs", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("新建文档").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetJSONRequestBody(schema.CreateDoc{}).
|
|
AddJSONResponse(200, schema.Doc{}).OK()
|
|
|
|
app.Put("/docs/:id", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("更新文档").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.DocID{}).
|
|
SetJSONRequestBody(schema.ListDocQuery{}).
|
|
AddJSONResponse(200, schema.Doc{}).OK()
|
|
|
|
app.Delete("/docs/:id", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("获取文档列表").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.DocID{}).
|
|
AddJSONResponse(200, nil).OK()
|
|
|
|
app.Post("/docs/batch/delete", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("批量-文件删除").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetJSONRequestBody(schema.DocsBatchDelete{}).
|
|
AddJSONResponse(200, schema.DocsBatchResults{}).OK()
|
|
|
|
app.Post("/docs/batch/update", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("批量-文件删除").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetJSONRequestBody(schema.DocsBatchUpdate{}).
|
|
AddJSONResponse(200, schema.DocsBatchResults{}).OK()
|
|
|
|
app.Get("/doc-folders", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("获取文件夹树").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.GetDocFolderTree{}).
|
|
AddJSONResponse(200, schema.DocFolderWithChildren{}).OK()
|
|
|
|
app.Post("/doc-folders", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("新建文件夹").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetJSONRequestBody(schema.CreateDocFolder{}).
|
|
AddJSONResponse(200, schema.DocFolder{}).OK()
|
|
|
|
app.Put("/doc-folders/:id", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("更新文件夹").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.DocFolderID{}).
|
|
SetJSONRequestBody(schema.UpdateDocFolder{}).
|
|
AddJSONResponse(200, schema.DocFolder{}).OK()
|
|
|
|
app.Delete("/doc-folders/:id", nil).
|
|
AddTags("文档管理").
|
|
SetSummary("删除文件夹").
|
|
AddJWTSecurity(JWTRequired).
|
|
SetParameters(schema.DocFolderID{}).
|
|
AddJSONResponse(200, nil).OK()
|
|
}
|