fix: remove redundante names
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 44s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 49s

This commit was merged in pull request #299.
This commit is contained in:
2024-12-04 23:22:25 +01:00
parent 2d5f42bb28
commit 5ef59df2d0
16 changed files with 228 additions and 230 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 {