init
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// handleListExercises behandelt GET /api/v1/exercises.
|
||||
// Unterstützt optionale Query-Parameter: muscle_group und q (Namenssuche).
|
||||
func (h *Handler) handleListExercises(w http.ResponseWriter, r *http.Request) {
|
||||
uid, err := userID(r)
|
||||
if err != nil {
|
||||
@@ -23,6 +25,7 @@ func (h *Handler) handleListExercises(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, exercises)
|
||||
}
|
||||
|
||||
// handleCreateExercise behandelt POST /api/v1/exercises.
|
||||
func (h *Handler) handleCreateExercise(w http.ResponseWriter, r *http.Request) {
|
||||
uid, err := userID(r)
|
||||
if err != nil {
|
||||
@@ -48,6 +51,7 @@ func (h *Handler) handleCreateExercise(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusCreated, exercise)
|
||||
}
|
||||
|
||||
// handleUpdateExercise behandelt PUT /api/v1/exercises/{id}.
|
||||
func (h *Handler) handleUpdateExercise(w http.ResponseWriter, r *http.Request) {
|
||||
uid, err := userID(r)
|
||||
if err != nil {
|
||||
@@ -82,6 +86,8 @@ func (h *Handler) handleUpdateExercise(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, exercise)
|
||||
}
|
||||
|
||||
// handleDeleteExercise behandelt DELETE /api/v1/exercises/{id}.
|
||||
// Führt einen Soft-Delete durch (setzt deleted_at).
|
||||
func (h *Handler) handleDeleteExercise(w http.ResponseWriter, r *http.Request) {
|
||||
uid, err := userID(r)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user