You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
9.5 KiB
410 lines
9.5 KiB
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.8.4
|
|
|
|
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"healthapi/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
)
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/auth/login",
|
|
Handler: LoginHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/auth/refresh",
|
|
Handler: RefreshTokenHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/auth/register",
|
|
Handler: RegisterHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/auth/send-code",
|
|
Handler: SendCodeHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/health",
|
|
Handler: HealthCheckHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products",
|
|
Handler: GetProductListHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/:id",
|
|
Handler: GetProductHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/category",
|
|
Handler: GetProductsByCategoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/search",
|
|
Handler: SearchProductsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/sync/purchase",
|
|
Handler: SyncPurchaseHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/constitution/history",
|
|
Handler: GetAssessmentHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/constitution/questions",
|
|
Handler: GetQuestionsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/constitution/questions/grouped",
|
|
Handler: GetGroupedQuestionsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/constitution/recommendations",
|
|
Handler: GetRecommendationsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/constitution/result",
|
|
Handler: GetAssessmentResultHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/constitution/submit",
|
|
Handler: SubmitAssessmentHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/conversations",
|
|
Handler: GetConversationsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/conversations",
|
|
Handler: CreateConversationHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/conversations/:id",
|
|
Handler: GetConversationHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/conversations/:id",
|
|
Handler: DeleteConversationHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/conversations/:id/messages",
|
|
Handler: SendMessageHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/conversations/:id/messages/stream",
|
|
Handler: SendMessageStreamHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/recommend",
|
|
Handler: GetRecommendProductsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/allergy",
|
|
Handler: SubmitAllergyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/allergy/batch",
|
|
Handler: BatchSubmitAllergyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/basic-info",
|
|
Handler: SubmitBasicInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/complete",
|
|
Handler: CompleteSurveyHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/family-history",
|
|
Handler: SubmitFamilyHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/family-history/batch",
|
|
Handler: BatchSubmitFamilyHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/lifestyle",
|
|
Handler: SubmitLifestyleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/medical-history",
|
|
Handler: SubmitMedicalHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/survey/medical-history/batch",
|
|
Handler: BatchSubmitMedicalHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/survey/status",
|
|
Handler: GetSurveyStatusHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/allergy-records",
|
|
Handler: GetAllergyRecordsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/user/allergy-records/:id",
|
|
Handler: DeleteAllergyRecordHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/basic-profile",
|
|
Handler: GetBasicProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/family-history",
|
|
Handler: GetFamilyHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/user/family-history/:id",
|
|
Handler: DeleteFamilyHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/health-profile",
|
|
Handler: GetHealthProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/user/health-profile",
|
|
Handler: UpdateHealthProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/lifestyle",
|
|
Handler: GetLifestyleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/user/lifestyle",
|
|
Handler: UpdateLifestyleHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/medical-history",
|
|
Handler: GetMedicalHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/user/medical-history/:id",
|
|
Handler: DeleteMedicalHistoryHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/profile",
|
|
Handler: GetUserProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/user/profile",
|
|
Handler: UpdateUserProfileHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/user/purchase-history",
|
|
Handler: GetPurchaseHistoryHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/categories",
|
|
Handler: GetCategoriesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products",
|
|
Handler: GetMallProductsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/:id",
|
|
Handler: GetMallProductDetailHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/featured",
|
|
Handler: GetFeaturedProductsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/search",
|
|
Handler: SearchMallProductsHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithPrefix("/api/mall"),
|
|
)
|
|
|
|
server.AddRoutes(
|
|
[]rest.Route{
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/addresses",
|
|
Handler: GetAddressesHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/addresses",
|
|
Handler: CreateAddressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/addresses/:id",
|
|
Handler: GetAddressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/addresses/:id",
|
|
Handler: UpdateAddressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/addresses/:id",
|
|
Handler: DeleteAddressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/addresses/:id/default",
|
|
Handler: SetDefaultAddressHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/cart",
|
|
Handler: GetCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/cart",
|
|
Handler: AddCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPut,
|
|
Path: "/cart/:id",
|
|
Handler: UpdateCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/cart/:id",
|
|
Handler: DeleteCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/cart/batch-select",
|
|
Handler: BatchSelectCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodDelete,
|
|
Path: "/cart/clear",
|
|
Handler: ClearCartHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/member/info",
|
|
Handler: GetMemberInfoHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/member/points/records",
|
|
Handler: GetPointsRecordsHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/orders",
|
|
Handler: GetOrdersHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/orders",
|
|
Handler: CreateOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/orders/:id",
|
|
Handler: GetOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/orders/:id/cancel",
|
|
Handler: CancelOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/orders/:id/pay",
|
|
Handler: PayOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/orders/:id/receive",
|
|
Handler: ConfirmReceiveHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodPost,
|
|
Path: "/orders/preview",
|
|
Handler: PreviewOrderHandler(serverCtx),
|
|
},
|
|
{
|
|
Method: http.MethodGet,
|
|
Path: "/products/constitution-recommend",
|
|
Handler: GetConstitutionProductsHandler(serverCtx),
|
|
},
|
|
},
|
|
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
|
rest.WithPrefix("/api/mall"),
|
|
)
|
|
}
|
|
|