Initial commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Christoph K.
2026-03-21 15:03:55 +01:00
commit dfd66e43c6
78 changed files with 6219 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
package model
import (
"errors"
"strings"
"time"
)
// TrainingSet ist eine benannte Zusammenstellung von Übungen.
type TrainingSet struct {
ID int64 `json:"id"`
Name string `json:"name"`
Exercises []Exercise `json:"exercises"`
CreatedAt time.Time `json:"created_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
// CreateSetRequest enthält die Felder zum Anlegen eines Sets.
type CreateSetRequest struct {
Name string `json:"name"`
ExerciseIDs []int64 `json:"exercise_ids"`
}
// Validate prüft und normalisiert den Request.
func (r *CreateSetRequest) Validate() error {
r.Name = strings.TrimSpace(r.Name)
if len(r.Name) == 0 || len(r.Name) > 100 {
return errors.New("Name muss 1100 Zeichen lang sein")
}
if len(r.ExerciseIDs) == 0 {
return errors.New("Mindestens eine Übung erforderlich")
}
return nil
}
// UpdateSetRequest enthält die Felder zum Aktualisieren eines Sets.
type UpdateSetRequest struct {
Name string `json:"name"`
ExerciseIDs []int64 `json:"exercise_ids"`
}
// Validate prüft und normalisiert den Request.
func (r *UpdateSetRequest) Validate() error {
r.Name = strings.TrimSpace(r.Name)
if len(r.Name) == 0 || len(r.Name) > 100 {
return errors.New("Name muss 1100 Zeichen lang sein")
}
if len(r.ExerciseIDs) == 0 {
return errors.New("Mindestens eine Übung erforderlich")
}
return nil
}