feat: added exercises handler/service/repo

This commit is contained in:
2026-09-04 12:29:44 +02:00
parent f0304cda1a
commit e1f274b744
9 changed files with 561 additions and 4 deletions
+5
View File
@@ -26,11 +26,13 @@ func NewMux(cfg Config) http.Handler {
userService := domain.NewUserService(store.User)
registrationService := domain.NewRegistrationService(store, userService, inviteService)
listService := domain.NewListService(store, store.List)
exerciseService := domain.NewExerciseService(store.Exercise)
authHandler := handler.NewAuthHandler(authService)
inviteHandler := handler.NewInviteHandler(inviteService)
userHandler := handler.NewUserHandler(userService, authService, registrationService)
listHandler := handler.NewListHandler(listService, userService)
exerciseHandler := handler.NewExerciseHandler(exerciseService)
protected := middleware.WithJWT(authService)
@@ -70,6 +72,9 @@ func NewMux(cfg Config) http.Handler {
apiMux.Handle("POST /lists/items/{id}/complete", protected(listHandler.SetListItemCompleted))
apiMux.Handle("GET /lists/{id}", protected(listHandler.GetListItems))
// Exercises
apiMux.Handle("GET /exercises", protected(exerciseHandler.GetExercises))
mux := http.NewServeMux()
mux.Handle("/api/v1/", http.StripPrefix("/api/v1", apiMux))