feat: Add REST API handlers for exercises, plans, and sessions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
35
backend/internal/api/interfaces.go
Normal file
35
backend/internal/api/interfaces.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"training-tracker/internal/models"
|
||||
)
|
||||
|
||||
// ExerciseRepository defines the interface for exercise storage operations
|
||||
type ExerciseRepository interface {
|
||||
List(ctx context.Context) ([]models.Exercise, error)
|
||||
GetByID(ctx context.Context, id int64) (*models.Exercise, error)
|
||||
Create(ctx context.Context, req *models.CreateExerciseRequest) (*models.Exercise, error)
|
||||
Update(ctx context.Context, id int64, req *models.CreateExerciseRequest) (*models.Exercise, error)
|
||||
Delete(ctx context.Context, id int64) error
|
||||
}
|
||||
|
||||
// PlanRepository defines the interface for training plan storage operations
|
||||
type PlanRepository interface {
|
||||
List(ctx context.Context) ([]models.TrainingPlan, error)
|
||||
GetByID(ctx context.Context, id int64) (*models.TrainingPlan, error)
|
||||
Create(ctx context.Context, req *models.CreatePlanRequest) (*models.TrainingPlan, error)
|
||||
Update(ctx context.Context, id int64, req *models.CreatePlanRequest) (*models.TrainingPlan, error)
|
||||
Delete(ctx context.Context, id int64) error
|
||||
}
|
||||
|
||||
// SessionRepository defines the interface for session storage operations
|
||||
type SessionRepository interface {
|
||||
List(ctx context.Context) ([]models.Session, error)
|
||||
GetByID(ctx context.Context, id int64) (*models.Session, error)
|
||||
Create(ctx context.Context, req *models.CreateSessionRequest) (*models.Session, error)
|
||||
Update(ctx context.Context, id int64, req *models.CreateSessionRequest) (*models.Session, error)
|
||||
Delete(ctx context.Context, id int64) error
|
||||
AddEntry(ctx context.Context, sessionID int64, req *models.CreateSessionEntryRequest) (*models.SessionEntry, error)
|
||||
}
|
||||
Reference in New Issue
Block a user