Skip to content

Commit 5ad7041

Browse files
committed
chore: move register event handler to protected routes
1 parent f27a8d2 commit 5ad7041

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

cmd/serve_http.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,28 +150,28 @@ func registerHandler(app app.App) *mux.Router {
150150
public.HandleFunc("/storage/{kind}/{path}", app.ImageHandler.GetStorage).Methods(http.MethodGet)
151151
public.HandleFunc("/events", app.EventHandler.List).Methods(http.MethodGet)
152152
public.HandleFunc("/events/{id}", app.EventHandler.GetEventByID).Methods(http.MethodGet)
153+
// public.HandleFunc("/events/registrations/{order_no}", app.EventHandler.RegistrationStatus).Methods(http.MethodGet)
154+
// public.HandleFunc("/events/pay", app.EventHandler.PayEvent).Methods(http.MethodPost)
153155
public.HandleFunc("/images", app.ImageHandler.UploadImage).Methods(http.MethodPost)
154-
public.HandleFunc("/events/registrations", app.EventHandler.RegisterEvent).Methods(http.MethodPost)
155-
public.HandleFunc("/events/registrations/{order_no}", app.EventHandler.RegistrationStatus).Methods(http.MethodGet)
156-
public.HandleFunc("/events/pay", app.EventHandler.PayEvent).Methods(http.MethodPost)
157156
public.HandleFunc("/blogs", app.BlogPostHandler.GetAllBlogPosts).Methods(http.MethodGet)
158157
public.HandleFunc("/blogs/{slug}", app.BlogPostHandler.GetDetailBlogPost).Methods(http.MethodGet)
159-
158+
160159
protectedV1Route := v1.NewRoute().Subrouter()
161160
protectedV1Route.Use(app.Middleware.AuthMiddleware(constants.RoleUser))
162-
161+
163162
protectedV1AdminRoute := v1.PathPrefix("/admin").Subrouter()
164163
protectedV1AdminRoute.Use(app.Middleware.AuthMiddleware(constants.RoleAdmin))
165-
164+
166165
protectedV1Route.HandleFunc("/users", app.UserHandler.GetUsers).Methods(http.MethodGet)
167166
protectedV1Route.HandleFunc("/user", app.UserHandler.GetUserProfile).Methods(http.MethodGet)
168167
protectedV1Route.HandleFunc("/logout", app.UserHandler.Logout).Methods(http.MethodPost)
169-
168+
170169
protectedV1Route.HandleFunc("/", app.UserHandler.GetUserById).Methods(http.MethodGet)
171170
protectedV1Route.HandleFunc("/update", app.UserHandler.UpdateProfileUser).Methods(http.MethodPut)
172171
protectedV1Route.HandleFunc("/delete", app.UserHandler.DeleteUser).Methods(http.MethodDelete)
173-
172+
174173
protectedV1Route.HandleFunc("/events", app.EventHandler.CreateEvent).Methods(http.MethodPost)
174+
protectedV1Route.HandleFunc("/events/registrations", app.EventHandler.RegisterEvent).Methods(http.MethodPost)
175175
protectedV1Route.HandleFunc("/events/registrations", app.EventHandler.ListRegistration).Methods(http.MethodGet)
176176
protectedV1Route.HandleFunc("/events/pays", app.EventHandler.ListEventPay).Methods(http.MethodGet)
177177
protectedV1Route.HandleFunc("/events/pays", app.EventHandler.PayProcess).Methods(http.MethodPost)

0 commit comments

Comments
 (0)