Files
juwan-backend/app/search/api/internal/handler/routes.go
T
2026-04-24 13:24:58 +08:00

65 lines
1.4 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
package handler
import (
"net/http"
favorites "juwan-backend/app/search/api/internal/handler/favorites"
search "juwan-backend/app/search/api/internal/handler/search"
"juwan-backend/app/search/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: "/favorites",
Handler: favorites.ListFavoritesHandler(serverCtx),
},
{
// 添加收藏
Method: http.MethodPost,
Path: "/favorites",
Handler: favorites.AddFavoriteHandler(serverCtx),
},
{
// 取消收藏
Method: http.MethodDelete,
Path: "/favorites/:id",
Handler: favorites.RemoveFavoriteHandler(serverCtx),
},
{
// 检查收藏状态
Method: http.MethodGet,
Path: "/users/:id/favorites/check",
Handler: favorites.CheckFavoriteHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 首页推荐
Method: http.MethodGet,
Path: "/recommendations/home",
Handler: search.RecommendationsHandler(serverCtx),
},
{
// 统一搜索
Method: http.MethodGet,
Path: "/search",
Handler: search.SearchHandler(serverCtx),
},
},
rest.WithPrefix("/api/v1"),
)
}