// Code generated by goctl. DO NOT EDIT. // goctl 1.8.4 package handler import ( "net/http" auth "photography-backend/internal/handler/auth" category "photography-backend/internal/handler/category" health "photography-backend/internal/handler/health" photo "photography-backend/internal/handler/photo" user "photography-backend/internal/handler/user" "photography-backend/internal/svc" "github.com/zeromicro/go-zero/rest" ) func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( []rest.Route{}, rest.WithJwt(serverCtx.Config.Auth.AccessSecret), ) server.AddRoutes( []rest.Route{ { // 用户登录 Method: http.MethodPost, Path: "/login", Handler: auth.LoginHandler(serverCtx), }, { // 用户注册 Method: http.MethodPost, Path: "/register", Handler: auth.RegisterHandler(serverCtx), }, }, rest.WithPrefix("/api/v1/auth"), ) server.AddRoutes( []rest.Route{ { // 获取分类列表 Method: http.MethodGet, Path: "/", Handler: category.GetCategoryListHandler(serverCtx), }, { // 创建分类 Method: http.MethodPost, Path: "/", Handler: category.CreateCategoryHandler(serverCtx), }, { // 获取分类详情 Method: http.MethodGet, Path: "/:id", Handler: category.GetCategoryHandler(serverCtx), }, { // 更新分类 Method: http.MethodPut, Path: "/:id", Handler: category.UpdateCategoryHandler(serverCtx), }, { // 删除分类 Method: http.MethodDelete, Path: "/:id", Handler: category.DeleteCategoryHandler(serverCtx), }, }, rest.WithJwt(serverCtx.Config.Auth.AccessSecret), rest.WithPrefix("/api/v1/categories"), ) server.AddRoutes( []rest.Route{ { // 健康检查 Method: http.MethodGet, Path: "/health", Handler: health.HealthHandler(serverCtx), }, }, rest.WithPrefix("/api/v1"), ) server.AddRoutes( []rest.Route{ { // 获取照片列表 Method: http.MethodGet, Path: "/", Handler: photo.GetPhotoListHandler(serverCtx), }, { // 上传照片 Method: http.MethodPost, Path: "/", Handler: photo.UploadPhotoHandler(serverCtx), }, { // 获取照片详情 Method: http.MethodGet, Path: "/:id", Handler: photo.GetPhotoHandler(serverCtx), }, { // 更新照片 Method: http.MethodPut, Path: "/:id", Handler: photo.UpdatePhotoHandler(serverCtx), }, { // 删除照片 Method: http.MethodDelete, Path: "/:id", Handler: photo.DeletePhotoHandler(serverCtx), }, }, rest.WithJwt(serverCtx.Config.Auth.AccessSecret), rest.WithPrefix("/api/v1/photos"), ) server.AddRoutes( []rest.Route{ { // 获取用户列表 Method: http.MethodGet, Path: "/", Handler: user.GetUserListHandler(serverCtx), }, { // 创建用户 Method: http.MethodPost, Path: "/", Handler: user.CreateUserHandler(serverCtx), }, { // 获取用户详情 Method: http.MethodGet, Path: "/:id", Handler: user.GetUserHandler(serverCtx), }, { // 更新用户 Method: http.MethodPut, Path: "/:id", Handler: user.UpdateUserHandler(serverCtx), }, { // 删除用户 Method: http.MethodDelete, Path: "/:id", Handler: user.DeleteUserHandler(serverCtx), }, }, rest.WithJwt(serverCtx.Config.Auth.AccessSecret), rest.WithPrefix("/api/v1/users"), ) }