83 lines
1.9 KiB
Go
83 lines
1.9 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.10.1
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
file "sundynix-micro-go/app/file/api/internal/handler/file"
|
|
"sundynix-micro-go/app/file/api/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
// 获取文件信息
|
|
Method: http.MethodGet,
|
|
Path: "/:id",
|
|
Handler: file.GetFileByIdHandler(serverCtx),
|
|
},
|
|
{
|
|
// 创建存储配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/create",
|
|
Handler: file.CreateStorageConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除存储配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/delete",
|
|
Handler: file.DeleteStorageConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 获取存储配置列表
|
|
Method: http.MethodPost,
|
|
Path: "/config/list",
|
|
Handler: file.GetStorageConfigListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 设置默认存储配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/setDefault",
|
|
Handler: file.SetDefaultStorageConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 更新存储配置
|
|
Method: http.MethodPost,
|
|
Path: "/config/update",
|
|
Handler: file.UpdateStorageConfigHandler(serverCtx),
|
|
},
|
|
{
|
|
// 删除文件
|
|
Method: http.MethodPost,
|
|
Path: "/delete",
|
|
Handler: file.DeleteFileHandler(serverCtx),
|
|
},
|
|
{
|
|
// 下载文件
|
|
Method: http.MethodGet,
|
|
Path: "/download/:id",
|
|
Handler: file.DownloadFileHandler(serverCtx),
|
|
},
|
|
{
|
|
// 文件列表
|
|
Method: http.MethodPost,
|
|
Path: "/list",
|
|
Handler: file.GetFileListHandler(serverCtx),
|
|
},
|
|
{
|
|
// 上传文件
|
|
Method: http.MethodPost,
|
|
Path: "/upload",
|
|
Handler: file.UploadFileHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/file"),
|
|
)
|
|
}
|