fix: remove redundante names
Some checks failed
Build Docker Image / Build-Docker-Image (push) Failing after 37s

This commit is contained in:
2024-12-04 23:22:25 +01:00
parent 2d5f42bb28
commit a69e9537d2
15 changed files with 188 additions and 190 deletions

View File

@@ -11,32 +11,32 @@ import (
"time"
)
type WorkoutHandler interface {
type Workout interface {
Handle(router *http.ServeMux)
}
type WorkoutHandlerImpl struct {
service service.WorkoutService
auth service.AuthService
type WorkoutImpl struct {
service service.Workout
auth service.Auth
render *Render
}
func NewWorkoutHandler(service service.WorkoutService, auth service.AuthService, render *Render) WorkoutHandler {
return WorkoutHandlerImpl{
func NewWorkout(service service.Workout, auth service.Auth, render *Render) Workout {
return WorkoutImpl{
service: service,
auth: auth,
render: render,
}
}
func (handler WorkoutHandlerImpl) Handle(router *http.ServeMux) {
func (handler WorkoutImpl) Handle(router *http.ServeMux) {
router.Handle("/workout", handler.handleWorkoutPage())
router.Handle("POST /api/workout", handler.handleAddWorkout())
router.Handle("GET /api/workout", handler.handleGetWorkout())
router.Handle("DELETE /api/workout/{id}", handler.handleDeleteWorkout())
}
func (handler WorkoutHandlerImpl) handleWorkoutPage() http.HandlerFunc {
func (handler WorkoutImpl) handleWorkoutPage() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user, err := handler.auth.GetUserFromSessionId(utils.GetSessionID(r))
if err != nil {
@@ -50,7 +50,7 @@ func (handler WorkoutHandlerImpl) handleWorkoutPage() http.HandlerFunc {
}
}
func (handler WorkoutHandlerImpl) handleAddWorkout() http.HandlerFunc {
func (handler WorkoutImpl) handleAddWorkout() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user, err := handler.auth.GetUserFromSessionId(utils.GetSessionID(r))
if err != nil {
@@ -77,7 +77,7 @@ func (handler WorkoutHandlerImpl) handleAddWorkout() http.HandlerFunc {
}
}
func (handler WorkoutHandlerImpl) handleGetWorkout() http.HandlerFunc {
func (handler WorkoutImpl) handleGetWorkout() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user, err := handler.auth.GetUserFromSessionId(utils.GetSessionID(r))
if err != nil {
@@ -100,7 +100,7 @@ func (handler WorkoutHandlerImpl) handleGetWorkout() http.HandlerFunc {
}
}
func (handler WorkoutHandlerImpl) handleDeleteWorkout() http.HandlerFunc {
func (handler WorkoutImpl) handleDeleteWorkout() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user, err := handler.auth.GetUserFromSessionId(utils.GetSessionID(r))
if err != nil {