fix: remove redundante names
This commit was merged in pull request #299.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user