Documentation
¶
Index ¶
- func CalculateBPCategory(systolic, diastolic int) string
- func CalculateWeightTrend(currentWeight float64, previousTrend *float64) float64
- func CategorySeverity(category string) int
- type BPGoal
- type BPPeriodStats
- type BPReminderState
- type BPStats
- type BloodPressure
- type ExerciseStat
- type FoodLog
- type FoodProduct
- type FoodStats
- type FoodTargets
- type IntakeLog
- type IntakeWithMedication
- type Medication
- type OpenFoodFact
- type PushSubscription
- type Restock
- type ScheduleConfig
- type SleepLog
- type Store
- func (s *Store) AddExerciseToVariant(variantID int64, exerciseName string, targetSets, targetRepsMin int, ...) (*WorkoutExercise, error)
- func (s *Store) AddIntakeReminder(intakeID int64, messageID int) error
- func (s *Store) AddRestock(medID int64, qty int, note string) error
- func (s *Store) AdvanceRotation(groupID int64) error
- func (s *Store) CalculatePreferredReminderHour(ctx context.Context, userID int64) (int, error)
- func (s *Store) CalculatePreferredWeightReminderHour(ctx context.Context, userID int64) (int, error)
- func (s *Store) ClearBPReminderNotificationMessage(userID int64) error
- func (s *Store) ClearSnooze(id int64) error
- func (s *Store) ClearWeightReminderNotificationMessage(userID int64) error
- func (s *Store) Close() error
- func (s *Store) CompleteSession(id int64) error
- func (s *Store) ConfirmIntake(id int64, takenAt time.Time) error
- func (s *Store) ConfirmIntakesBySchedule(userID int64, scheduledAt time.Time, takenAt time.Time) error
- func (s *Store) CreateAdHocWorkoutSession(userID int64, scheduledDate time.Time, scheduledTime string) (*WorkoutSession, error)
- func (s *Store) CreateBloodPressureReading(ctx context.Context, bp *BloodPressure) (int64, error)
- func (s *Store) CreateFoodLog(ctx context.Context, f *FoodLog) (int64, error)
- func (s *Store) CreateGroupSnapshot(groupID int64, snapshotData, changeReason string) error
- func (s *Store) CreateIntake(medID, userID int64, scheduledAt time.Time) (int64, error)
- func (s *Store) CreateManualIntake(medID, userID int64, takenAt time.Time) (int64, error)
- func (s *Store) CreateMedication(name, dosage, schedule string, startDate, endDate *time.Time, ...) (int64, error)
- func (s *Store) CreatePushSubscription(userID int64, endpoint, auth, p256dh string) error
- func (s *Store) CreateWeightLog(ctx context.Context, w *WeightLog) (int64, error)
- func (s *Store) CreateWorkoutGroup(name, description string, isRotating bool, userID int64, daysOfWeek string, ...) (*WorkoutGroup, error)
- func (s *Store) CreateWorkoutSession(groupID, variantID, userID int64, scheduledDate time.Time, ...) (*WorkoutSession, error)
- func (s *Store) CreateWorkoutVariant(groupID int64, name string, rotationOrder *int, description string) (*WorkoutVariant, error)
- func (s *Store) DecrementInventory(medID int64, qty int) error
- func (s *Store) DeleteBloodPressureReading(ctx context.Context, id, userID int64) error
- func (s *Store) DeleteFoodLog(ctx context.Context, id, userID int64) error
- func (s *Store) DeleteIntake(id int64) error
- func (s *Store) DeleteMedication(id int64) error
- func (s *Store) DeletePushSubscription(endpoint string) error
- func (s *Store) DeleteWeightLog(ctx context.Context, id, userID int64) error
- func (s *Store) DeleteWorkoutExercise(id int64) error
- func (s *Store) DeleteWorkoutVariant(id int64) error
- func (s *Store) DisablePushSubscription(endpoint string) error
- func (s *Store) DontBugMeBPReminder(userID int64) error
- func (s *Store) DontBugMeWeightReminder(userID int64) error
- func (s *Store) GetActiveSessions(userID int64, date time.Time) ([]WorkoutSession, error)
- func (s *Store) GetAllUniqueExercises(userID int64) ([]WorkoutExercise, error)
- func (s *Store) GetBPDailyWeightedStats(ctx context.Context, userID int64) (*BPStats, error)
- func (s *Store) GetBPGoal() (*BPGoal, error)
- func (s *Store) GetBPReminderState(userID int64) (*BPReminderState, error)
- func (s *Store) GetBloodPressureEnabled(ctx context.Context) (bool, error)
- func (s *Store) GetBloodPressureReadings(ctx context.Context, userID int64, since time.Time) ([]BloodPressure, error)
- func (s *Store) GetDaysOfStockRemaining(m *Medication) *float64
- func (s *Store) GetDominantBPCategory(ctx context.Context, userID int64) (string, error)
- func (s *Store) GetExerciseLogs(sessionID int64) ([]WorkoutExerciseLog, error)
- func (s *Store) GetExerciseStats(userID int64) ([]ExerciseStat, error)
- func (s *Store) GetFoodIntakeEnabled(ctx context.Context) (bool, error)
- func (s *Store) GetFoodLogs(ctx context.Context, userID int64, date time.Time, days int) ([]FoodLog, error)
- func (s *Store) GetFoodProducts(ctx context.Context, userID int64, limit int) ([]FoodProduct, error)
- func (s *Store) GetFoodStats(ctx context.Context, userID int64, endDate time.Time, days int) (*FoodStats, error)
- func (s *Store) GetFoodTargets(ctx context.Context) (FoodTargets, error)
- func (s *Store) GetGroupSnapshots(groupID int64) ([]WorkoutScheduleSnapshot, error)
- func (s *Store) GetHighestWeightRecord(ctx context.Context, userID int64) (*WeightLog, error)
- func (s *Store) GetIntake(id int64) (*IntakeLog, error)
- func (s *Store) GetIntakeBySchedule(medID int64, scheduledAt time.Time) (*IntakeLog, error)
- func (s *Store) GetIntakeHistory(medID int, days int) ([]IntakeLog, error)
- func (s *Store) GetIntakeReminders(intakeID int64) ([]int, error)
- func (s *Store) GetIntakesSince(since time.Time) ([]IntakeWithMedication, error)
- func (s *Store) GetLastBPReading(ctx context.Context, userID int64) (*BloodPressure, error)
- func (s *Store) GetLastDownload() (time.Time, error)
- func (s *Store) GetLastWeightLog(ctx context.Context, userID int64) (*WeightLog, error)
- func (s *Store) GetMedication(id int64) (*Medication, error)
- func (s *Store) GetMedicationEnabled(ctx context.Context) (bool, error)
- func (s *Store) GetMedicationsLowOnStock(daysThreshold int) ([]Medication, error)
- func (s *Store) GetPendingIntakes() ([]IntakeLog, error)
- func (s *Store) GetPendingIntakesBySchedule(userID int64, scheduledAt time.Time) ([]IntakeLog, error)
- func (s *Store) GetPendingIntakesForMedication(medID int64) ([]IntakeLog, error)
- func (s *Store) GetPushSubscriptions(userID int64) ([]PushSubscription, error)
- func (s *Store) GetRestockHistory(medID int64) ([]Restock, error)
- func (s *Store) GetRotationState(groupID int64) (*WorkoutRotationState, error)
- func (s *Store) GetSessionByGroupAndDate(groupID int64, scheduledDate time.Time) (*WorkoutSession, error)
- func (s *Store) GetSleepLogs(ctx context.Context, userID int64, since time.Time) ([]SleepLog, error)
- func (s *Store) GetSnoozedSessions(userID int64) ([]WorkoutSession, error)
- func (s *Store) GetUsersForBPReminders() ([]int64, error)
- func (s *Store) GetUsersForWeightReminders() ([]int64, error)
- func (s *Store) GetWeightEnabled(ctx context.Context) (bool, error)
- func (s *Store) GetWeightGoal() (*WeightGoal, error)
- func (s *Store) GetWeightLogs(ctx context.Context, userID int64, since time.Time) ([]WeightLog, error)
- func (s *Store) GetWeightReminderState(userID int64) (*WeightReminderState, error)
- func (s *Store) GetWorkoutEnabled(ctx context.Context) (bool, error)
- func (s *Store) GetWorkoutExercise(id int64) (*WorkoutExercise, error)
- func (s *Store) GetWorkoutGroup(id int64) (*WorkoutGroup, error)
- func (s *Store) GetWorkoutHistory(userID int64, limit int) ([]WorkoutSession, error)
- func (s *Store) GetWorkoutSession(id int64) (*WorkoutSession, error)
- func (s *Store) GetWorkoutVariant(id int64) (*WorkoutVariant, error)
- func (s *Store) ImportBloodPressureReadings(ctx context.Context, userID int64, readings []BloodPressure) error
- func (s *Store) ImportSleepLogs(ctx context.Context, userID int64, logs []SleepLog) (int, int, error)
- func (s *Store) InitializeRotation(groupID, startingVariantID int64) error
- func (s *Store) IsAdHocSession(sessionID int64) (bool, error)
- func (s *Store) IsLowOnStock(m *Medication, daysThreshold int) bool
- func (s *Store) ListExercisesByVariant(variantID int64) ([]WorkoutExercise, error)
- func (s *Store) ListMedications(showArchived bool) ([]Medication, error)
- func (s *Store) ListVariantsByGroup(groupID int64) ([]WorkoutVariant, error)
- func (s *Store) ListWorkoutGroups(userID int64, activeOnly bool) ([]WorkoutGroup, error)
- func (s *Store) LogExercise(sessionID, exerciseID int64, exerciseName string, ...) (int64, error)
- func (s *Store) SearchFoodProducts(ctx context.Context, userID int64, queryStr string) ([]FoodProduct, error)
- func (s *Store) SearchOpenFoodFactsAPI(ctx context.Context, query string) ([]FoodProduct, error)
- func (s *Store) SetBPGoal(targetSystolic, targetDiastolic int) error
- func (s *Store) SetBPReminderEnabled(userID int64, enabled bool) error
- func (s *Store) SetBloodPressureEnabled(ctx context.Context, enabled bool) error
- func (s *Store) SetFoodIntakeEnabled(ctx context.Context, enabled bool) error
- func (s *Store) SetFoodTargets(ctx context.Context, targets FoodTargets) error
- func (s *Store) SetInventory(medID int64, count *int) error
- func (s *Store) SetMedicationEnabled(ctx context.Context, enabled bool) error
- func (s *Store) SetSessionNotificationMessageID(id int64, messageID int) error
- func (s *Store) SetWeightEnabled(ctx context.Context, enabled bool) error
- func (s *Store) SetWeightGoal(weight float64, targetDate time.Time) error
- func (s *Store) SetWeightReminderEnabled(userID int64, enabled bool) error
- func (s *Store) SetWorkoutEnabled(ctx context.Context, enabled bool) error
- func (s *Store) SkipSession(id int64) error
- func (s *Store) SnoozeBPReminder(userID int64) error
- func (s *Store) SnoozeSession(id int64, snoozeDuration time.Duration) error
- func (s *Store) SnoozeWeightReminder(userID int64) error
- func (s *Store) StartSession(id int64) error
- func (s *Store) UpdateBPReminderNotificationSent(userID int64, messageID *int) error
- func (s *Store) UpdateExerciseLog(id int64, setsCompleted, repsCompleted *int, weightKg *float64, notes string) error
- func (s *Store) UpdateFoodLog(ctx context.Context, f *FoodLog) error
- func (s *Store) UpdateIntake(id int64, takenAt time.Time, status string) error
- func (s *Store) UpdateLastDownload(t time.Time) error
- func (s *Store) UpdateMedication(id int64, name, dosage, schedule string, archived bool, ...) error
- func (s *Store) UpdatePreferredReminderHour(userID int64, hour int) error
- func (s *Store) UpdatePreferredWeightReminderHour(userID int64, hour int) error
- func (s *Store) UpdateSessionStatus(id int64, status string) error
- func (s *Store) UpdateWeightReminderNotificationSent(userID int64, messageID *int) error
- func (s *Store) UpdateWorkoutExercise(id int64, exerciseName string, targetSets, targetRepsMin int, ...) error
- func (s *Store) UpdateWorkoutGroup(id int64, name, description string, isRotating bool, daysOfWeek string, ...) error
- func (s *Store) UpdateWorkoutSessionNotes(id int64, notes string) error
- func (s *Store) UpdateWorkoutVariant(id int64, name string, rotationOrder *int, description string) error
- func (s *Store) UpsertFoodProduct(ctx context.Context, p *FoodProduct) error
- type WeightGoal
- type WeightLog
- type WeightReminderState
- type WorkoutExercise
- type WorkoutExerciseLog
- type WorkoutGroup
- type WorkoutRotationState
- type WorkoutScheduleSnapshot
- type WorkoutSession
- type WorkoutVariant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateBPCategory ¶
func CalculateWeightTrend ¶
CalculateWeightTrend calculates a simple exponential moving average alpha = 0.1 gives roughly a 20-day smoothing
func CategorySeverity ¶
CategorySeverity returns a numeric value for category comparison (higher = worse)
Types ¶
type BPGoal ¶
type BPGoal struct {
TargetSystolic *int `json:"target_systolic,omitempty"`
TargetDiastolic *int `json:"target_diastolic,omitempty"`
}
BP Goal Settings
type BPPeriodStats ¶
type BPPeriodStats struct {
Systolic int `json:"systolic"`
Diastolic int `json:"diastolic"`
Days int `json:"days"` // Number of days with readings
Readings int `json:"readings"` // Total number of readings
}
BPPeriodStats represents daily-weighted BP stats for a specific time period
type BPReminderState ¶
type BPReminderState struct {
UserID int64 `json:"user_id"`
Enabled bool `json:"enabled"`
SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`
DontRemindUntil *time.Time `json:"dont_remind_until,omitempty"`
LastNotificationSentAt *time.Time `json:"last_notification_sent_at,omitempty"`
NotificationMessageID *int `json:"notification_message_id,omitempty"`
PreferredReminderHour int `json:"preferred_reminder_hour"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
BPReminderState represents the state of BP reminders for a user
type BPStats ¶
type BPStats struct {
Stats14 *BPPeriodStats `json:"stats_14,omitempty"`
Stats30 *BPPeriodStats `json:"stats_30,omitempty"`
Stats60 *BPPeriodStats `json:"stats_60,omitempty"`
}
BPStats contains daily time-weighted blood pressure statistics for multiple time periods
type BloodPressure ¶
type BloodPressure struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
MeasuredAt time.Time `json:"measured_at"`
Systolic int `json:"systolic"`
Diastolic int `json:"diastolic"`
Pulse *int `json:"pulse,omitempty"`
Site string `json:"site,omitempty"`
Position string `json:"position,omitempty"`
Category string `json:"category,omitempty"`
IgnoreCalc bool `json:"ignore_calc"`
Notes string `json:"notes,omitempty"`
Tag string `json:"tag,omitempty"`
}
type ExerciseStat ¶ added in v0.1.17
type ExerciseStat struct {
ExerciseName string `json:"exercise_name"`
SessionCount int `json:"session_count"`
TotalVolumeKg float64 `json:"total_volume_kg"`
MaxWeightKg float64 `json:"max_weight_kg"`
}
ExerciseStat holds aggregated statistics for a single exercise across all sessions
type FoodLog ¶ added in v0.1.17
type FoodLog struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
EatenAt time.Time `json:"eaten_at"`
Weight int `json:"weight"`
Carbs int `json:"carbs"` // total grams
Protein int `json:"protein"` // total grams
Fat int `json:"fat"` // total grams
Calories int `json:"calories"` // total kcal
Name string `json:"name,omitempty"`
}
type FoodProduct ¶ added in v0.1.17
type FoodProduct struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
Name string `json:"name"`
Barcode *string `json:"barcode,omitempty"`
Carbs100g float64 `json:"carbs_100g"`
Protein100g float64 `json:"protein_100g"`
Fat100g float64 `json:"fat_100g"`
EnergyKcal100g float64 `json:"energy_kcal_100g"`
UsageCount int `json:"usage_count"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt time.Time `json:"last_used_at"`
}
type FoodTargets ¶ added in v0.1.17
type IntakeWithMedication ¶
type Medication ¶
type Medication struct {
ID int64 `json:"id"`
Name string `json:"name"`
Dosage string `json:"dosage"`
Schedule string `json:"schedule"` // e.g. "09:00" or JSON
Archived bool `json:"archived"`
StartDate *time.Time `json:"start_date"`
EndDate *time.Time `json:"end_date"`
LastTakenAt *time.Time `json:"last_taken_at"`
CreatedAt time.Time `json:"created_at"`
RxCUI string `json:"rxcui,omitempty"`
NormalizedName string `json:"normalized_name,omitempty"`
InventoryCount *int `json:"inventory_count,omitempty"` // NULL = not tracking
}
func (*Medication) ValidSchedule ¶
func (m *Medication) ValidSchedule() (*ScheduleConfig, error)
type OpenFoodFact ¶ added in v0.1.17
type PushSubscription ¶
type PushSubscription struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
Endpoint string `json:"endpoint"`
Auth string `json:"auth"`
P256dh string `json:"p256dh"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PushSubscription represents a Web Push subscription
type ScheduleConfig ¶
type SleepLog ¶
type SleepLog struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
TimezoneOffset int `json:"timezone_offset"`
Day string `json:"day"`
LightMinutes *int `json:"light_minutes,omitempty"`
DeepMinutes *int `json:"deep_minutes,omitempty"`
REMMinutes *int `json:"rem_minutes,omitempty"`
AwakeMinutes *int `json:"awake_minutes,omitempty"`
TotalMinutes *int `json:"total_minutes,omitempty"`
TurnOverCount *int `json:"turn_over_count,omitempty"`
HeartRateAvg *int `json:"heart_rate_avg,omitempty"`
SpO2Avg *int `json:"spo2_avg,omitempty"`
UserModified bool `json:"user_modified"`
Notes string `json:"notes,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AddExerciseToVariant ¶
func (*Store) AddIntakeReminder ¶
func (*Store) AddRestock ¶
AddRestock adds inventory and logs the restock event
func (*Store) AdvanceRotation ¶
func (*Store) CalculatePreferredReminderHour ¶
CalculatePreferredReminderHour calculates the preferred reminder hour based on recent BP readings
func (*Store) CalculatePreferredWeightReminderHour ¶
func (s *Store) CalculatePreferredWeightReminderHour(ctx context.Context, userID int64) (int, error)
CalculatePreferredWeightReminderHour calculates the preferred reminder hour based on recent weight logs Analyzes last 14 days of weight logs, averages the hour of measurement Constraints: 6 AM - 12 PM range (morning weigh-ins recommended) Default: 9 AM if < 3 measurements Rationale: Weight measurements are most accurate in morning (fasting state)
func (*Store) ClearBPReminderNotificationMessage ¶ added in v0.1.17
ClearBPReminderNotificationMessage clears the stored Telegram message ID for the current BP reminder.
func (*Store) ClearSnooze ¶
func (*Store) ClearWeightReminderNotificationMessage ¶ added in v0.1.17
ClearWeightReminderNotificationMessage clears the stored Telegram message ID for the current weight reminder.
func (*Store) CompleteSession ¶
func (*Store) ConfirmIntakesBySchedule ¶
func (*Store) CreateAdHocWorkoutSession ¶
func (s *Store) CreateAdHocWorkoutSession(userID int64, scheduledDate time.Time, scheduledTime string) (*WorkoutSession, error)
CreateAdHocWorkoutSession creates an unscheduled workout session Uses -1 as sentinel values for group_id and variant_id
func (*Store) CreateBloodPressureReading ¶
func (*Store) CreateFoodLog ¶ added in v0.1.17
func (*Store) CreateGroupSnapshot ¶
func (*Store) CreateIntake ¶
func (*Store) CreateManualIntake ¶ added in v0.1.17
func (*Store) CreateMedication ¶
func (*Store) CreatePushSubscription ¶
func (*Store) CreateWeightLog ¶
func (*Store) CreateWorkoutGroup ¶
func (*Store) CreateWorkoutSession ¶
func (*Store) CreateWorkoutVariant ¶
func (*Store) DecrementInventory ¶
DecrementInventory reduces the inventory count by the given quantity Only decrements if inventory is being tracked (not NULL)
func (*Store) DeleteBloodPressureReading ¶
func (*Store) DeleteFoodLog ¶ added in v0.1.17
func (*Store) DeleteIntake ¶
func (*Store) DeleteMedication ¶
func (*Store) DeletePushSubscription ¶
func (*Store) DeleteWeightLog ¶
func (*Store) DeleteWorkoutExercise ¶
func (*Store) DeleteWorkoutVariant ¶
func (*Store) DisablePushSubscription ¶
func (*Store) DontBugMeBPReminder ¶
DontBugMeBPReminder disables BP reminders for 24 hours
func (*Store) DontBugMeWeightReminder ¶
DontBugMeWeightReminder disables weight reminders for 24 hours
func (*Store) GetActiveSessions ¶
func (*Store) GetAllUniqueExercises ¶
func (s *Store) GetAllUniqueExercises(userID int64) ([]WorkoutExercise, error)
GetAllUniqueExercises returns a deduplicated list of all exercises across all active workout groups for a user
func (*Store) GetBPDailyWeightedStats ¶
GetBPDailyWeightedStats calculates daily time-weighted blood pressure averages. It weights each reading by the time until the next reading, computes a per-day time-weighted average, then averages daily averages across the period.
func (*Store) GetBPReminderState ¶
func (s *Store) GetBPReminderState(userID int64) (*BPReminderState, error)
GetBPReminderState retrieves the BP reminder state for a user If no state exists, returns a default state with enabled=true
func (*Store) GetBloodPressureEnabled ¶ added in v0.1.17
func (*Store) GetBloodPressureReadings ¶
func (*Store) GetDaysOfStockRemaining ¶
func (s *Store) GetDaysOfStockRemaining(m *Medication) *float64
GetDaysOfStockRemaining calculates how many days of stock remain for a medication
func (*Store) GetDominantBPCategory ¶
GetDominantBPCategory calculates the dominant BP category over the last 14 days
func (*Store) GetExerciseLogs ¶
func (s *Store) GetExerciseLogs(sessionID int64) ([]WorkoutExerciseLog, error)
func (*Store) GetExerciseStats ¶ added in v0.1.17
func (s *Store) GetExerciseStats(userID int64) ([]ExerciseStat, error)
GetActiveSessions returns all sessions for a given date that are in 'notified' or 'in_progress' status This is used to display workouts that have been notified but not yet started/completed, even if their scheduled time has passed GetExerciseStats returns aggregated volume and max weight per exercise for a user. Only considers completed exercise logs that have weight data.
func (*Store) GetFoodIntakeEnabled ¶ added in v0.1.17
func (*Store) GetFoodLogs ¶ added in v0.1.17
func (*Store) GetFoodProducts ¶ added in v0.1.17
func (*Store) GetFoodStats ¶ added in v0.1.17
func (*Store) GetFoodTargets ¶ added in v0.1.17
func (s *Store) GetFoodTargets(ctx context.Context) (FoodTargets, error)
func (*Store) GetGroupSnapshots ¶
func (s *Store) GetGroupSnapshots(groupID int64) ([]WorkoutScheduleSnapshot, error)
func (*Store) GetHighestWeightRecord ¶
func (*Store) GetIntakeBySchedule ¶
func (*Store) GetIntakeHistory ¶
func (*Store) GetIntakeReminders ¶
func (*Store) GetIntakesSince ¶
func (s *Store) GetIntakesSince(since time.Time) ([]IntakeWithMedication, error)
func (*Store) GetLastBPReading ¶
GetLastBPReading retrieves the most recent BP reading for a user
func (*Store) GetLastWeightLog ¶
func (*Store) GetMedication ¶
func (s *Store) GetMedication(id int64) (*Medication, error)
func (*Store) GetMedicationEnabled ¶ added in v0.1.17
func (*Store) GetMedicationsLowOnStock ¶
func (s *Store) GetMedicationsLowOnStock(daysThreshold int) ([]Medication, error)
GetMedicationsLowOnStock returns medications with inventory tracking that are low on stock daysThreshold: warn if stock lasts fewer than this many days
func (*Store) GetPendingIntakes ¶
func (*Store) GetPendingIntakesBySchedule ¶
func (*Store) GetPendingIntakesForMedication ¶
func (*Store) GetPushSubscriptions ¶
func (s *Store) GetPushSubscriptions(userID int64) ([]PushSubscription, error)
func (*Store) GetRestockHistory ¶
GetRestockHistory returns restock events for a medication
func (*Store) GetRotationState ¶
func (s *Store) GetRotationState(groupID int64) (*WorkoutRotationState, error)
func (*Store) GetSessionByGroupAndDate ¶
func (*Store) GetSleepLogs ¶
func (s *Store) GetSleepLogs(ctx context.Context, userID int64, since time.Time) ([]SleepLog, error)
GetSleepLogs retrieves sleep logs for a user since a given date
func (*Store) GetSnoozedSessions ¶
func (s *Store) GetSnoozedSessions(userID int64) ([]WorkoutSession, error)
func (*Store) GetUsersForBPReminders ¶
GetUsersForBPReminders returns users who have BP reminders enabled
func (*Store) GetUsersForWeightReminders ¶
GetUsersForWeightReminders returns users who have weight reminders enabled
func (*Store) GetWeightEnabled ¶ added in v0.1.17
func (*Store) GetWeightGoal ¶
func (s *Store) GetWeightGoal() (*WeightGoal, error)
func (*Store) GetWeightLogs ¶
func (*Store) GetWeightReminderState ¶
func (s *Store) GetWeightReminderState(userID int64) (*WeightReminderState, error)
GetWeightReminderState retrieves the weight reminder state for a user If no state exists, returns a default state with enabled=true
func (*Store) GetWorkoutEnabled ¶ added in v0.1.17
func (*Store) GetWorkoutExercise ¶
func (s *Store) GetWorkoutExercise(id int64) (*WorkoutExercise, error)
func (*Store) GetWorkoutGroup ¶
func (s *Store) GetWorkoutGroup(id int64) (*WorkoutGroup, error)
func (*Store) GetWorkoutHistory ¶
func (s *Store) GetWorkoutHistory(userID int64, limit int) ([]WorkoutSession, error)
func (*Store) GetWorkoutSession ¶
func (s *Store) GetWorkoutSession(id int64) (*WorkoutSession, error)
func (*Store) GetWorkoutVariant ¶
func (s *Store) GetWorkoutVariant(id int64) (*WorkoutVariant, error)
func (*Store) ImportBloodPressureReadings ¶
func (*Store) ImportSleepLogs ¶
func (*Store) InitializeRotation ¶
func (*Store) IsAdHocSession ¶
IsAdHocSession checks if session is ad-hoc (group_id == -1)
func (*Store) IsLowOnStock ¶
func (s *Store) IsLowOnStock(m *Medication, daysThreshold int) bool
IsLowOnStock checks if a medication is low on stock considering its end date
func (*Store) ListExercisesByVariant ¶
func (s *Store) ListExercisesByVariant(variantID int64) ([]WorkoutExercise, error)
func (*Store) ListMedications ¶
func (s *Store) ListMedications(showArchived bool) ([]Medication, error)
func (*Store) ListVariantsByGroup ¶
func (s *Store) ListVariantsByGroup(groupID int64) ([]WorkoutVariant, error)
func (*Store) ListWorkoutGroups ¶
func (s *Store) ListWorkoutGroups(userID int64, activeOnly bool) ([]WorkoutGroup, error)
func (*Store) LogExercise ¶
func (*Store) SearchFoodProducts ¶ added in v0.1.17
func (*Store) SearchOpenFoodFactsAPI ¶ added in v0.1.17
SearchOpenFoodFactsAPI performs a live, resilient search against the OpenFoodFacts v0 (Barcode) or cgi (Text) endpoints. It maps the response safely to our local FoodProduct struct.
func (*Store) SetBPReminderEnabled ¶
SetBPReminderEnabled enables or disables BP reminders for a user
func (*Store) SetBloodPressureEnabled ¶ added in v0.1.17
func (*Store) SetFoodIntakeEnabled ¶ added in v0.1.17
func (*Store) SetFoodTargets ¶ added in v0.1.17
func (s *Store) SetFoodTargets(ctx context.Context, targets FoodTargets) error
func (*Store) SetInventory ¶
SetInventory sets the inventory count for a medication (nil to disable tracking)
func (*Store) SetMedicationEnabled ¶ added in v0.1.17
func (*Store) SetSessionNotificationMessageID ¶
func (*Store) SetWeightEnabled ¶ added in v0.1.17
func (*Store) SetWeightGoal ¶
func (*Store) SetWeightReminderEnabled ¶
SetWeightReminderEnabled enables or disables weight reminders for a user
func (*Store) SetWorkoutEnabled ¶ added in v0.1.17
func (*Store) SkipSession ¶
func (*Store) SnoozeBPReminder ¶
SnoozeBPReminder snoozes BP reminders for 2 hours
func (*Store) SnoozeSession ¶
func (*Store) SnoozeWeightReminder ¶
SnoozeWeightReminder snoozes weight reminders for 2 hours
func (*Store) StartSession ¶
func (*Store) UpdateBPReminderNotificationSent ¶
UpdateBPReminderNotificationSent records when a notification was sent
func (*Store) UpdateExerciseLog ¶
func (*Store) UpdateFoodLog ¶ added in v0.1.17
func (*Store) UpdateIntake ¶
func (*Store) UpdateMedication ¶
func (*Store) UpdatePreferredReminderHour ¶
UpdatePreferredReminderHour updates the preferred reminder hour for a user
func (*Store) UpdatePreferredWeightReminderHour ¶
UpdatePreferredWeightReminderHour updates the preferred reminder hour for a user
func (*Store) UpdateSessionStatus ¶
func (*Store) UpdateWeightReminderNotificationSent ¶
UpdateWeightReminderNotificationSent records when a notification was sent
func (*Store) UpdateWorkoutExercise ¶
func (*Store) UpdateWorkoutGroup ¶
func (*Store) UpdateWorkoutSessionNotes ¶
func (*Store) UpdateWorkoutVariant ¶
func (*Store) UpsertFoodProduct ¶ added in v0.1.17
func (s *Store) UpsertFoodProduct(ctx context.Context, p *FoodProduct) error
type WeightGoal ¶
type WeightGoal struct {
Goal *float64 `json:"goal,omitempty"`
GoalDate *time.Time `json:"goal_date,omitempty"`
}
Weight Goal Settings
type WeightLog ¶
type WeightLog struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
MeasuredAt time.Time `json:"measured_at"`
Weight float64 `json:"weight"`
WeightTrend *float64 `json:"weight_trend,omitempty"`
BodyFat *float64 `json:"body_fat,omitempty"`
BodyFatTrend *float64 `json:"body_fat_trend,omitempty"`
MuscleMass *float64 `json:"muscle_mass,omitempty"`
MuscleMassTrend *float64 `json:"muscle_mass_trend,omitempty"`
Notes string `json:"notes,omitempty"`
}
type WeightReminderState ¶
type WeightReminderState struct {
UserID int64 `json:"user_id"`
Enabled bool `json:"enabled"`
SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`
DontRemindUntil *time.Time `json:"dont_remind_until,omitempty"`
LastNotificationSentAt *time.Time `json:"last_notification_sent_at,omitempty"`
NotificationMessageID *int `json:"notification_message_id,omitempty"`
PreferredReminderHour int `json:"preferred_reminder_hour"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WeightReminderState represents the state of weight reminders for a user
type WorkoutExercise ¶
type WorkoutExercise struct {
ID int64 `json:"id"`
VariantID int64 `json:"variant_id"`
ExerciseName string `json:"exercise_name"`
TargetSets int `json:"target_sets"`
TargetRepsMin int `json:"target_reps_min"`
TargetRepsMax *int `json:"target_reps_max,omitempty"`
TargetWeightKg *float64 `json:"target_weight_kg,omitempty"`
OrderIndex int `json:"order_index"`
}
WorkoutExercise represents an exercise within a variant
type WorkoutExerciseLog ¶
type WorkoutExerciseLog struct {
ID int64 `json:"id"`
SessionID int64 `json:"session_id"`
ExerciseID int64 `json:"exercise_id"`
ExerciseName string `json:"exercise_name"`
SetsCompleted *int `json:"sets_completed,omitempty"`
RepsCompleted *int `json:"reps_completed,omitempty"`
WeightKg *float64 `json:"weight_kg,omitempty"`
Status string `json:"status"` // completed, skipped
Notes string `json:"notes,omitempty"`
LoggedAt time.Time `json:"logged_at"`
}
WorkoutExerciseLog represents completion of a single exercise
type WorkoutGroup ¶
type WorkoutGroup struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
IsRotating bool `json:"is_rotating"`
UserID int64 `json:"user_id"`
DaysOfWeek string `json:"days_of_week"` // JSON array
ScheduledTime string `json:"scheduled_time"`
NotificationAdvanceMinutes int `json:"notification_advance_minutes"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkoutGroup represents a workout group with schedule
type WorkoutRotationState ¶
type WorkoutRotationState struct {
GroupID int64 `json:"group_id"`
CurrentVariantID int64 `json:"current_variant_id"`
LastSessionDate *time.Time `json:"last_session_date,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkoutRotationState tracks the current rotation position
type WorkoutScheduleSnapshot ¶
type WorkoutScheduleSnapshot struct {
ID int64 `json:"id"`
GroupID int64 `json:"group_id"`
SnapshotData string `json:"snapshot_data"` // JSON
ChangeReason string `json:"change_reason,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
WorkoutScheduleSnapshot represents a snapshot of a group's schedule
type WorkoutSession ¶
type WorkoutSession struct {
ID int64 `json:"id"`
GroupID int64 `json:"group_id"` // -1 for ad-hoc workouts
VariantID int64 `json:"variant_id"` // -1 for ad-hoc workouts
UserID int64 `json:"user_id"`
ScheduledDate time.Time `json:"scheduled_date"`
ScheduledTime string `json:"scheduled_time"`
Status string `json:"status"` // pending, notified, in_progress, completed, skipped
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`
SnoozeCount int `json:"snooze_count"`
NotificationMessageID *int `json:"notification_message_id,omitempty"`
Notes string `json:"notes,omitempty"`
}
WorkoutSession represents an actual workout instance
type WorkoutVariant ¶
type WorkoutVariant struct {
ID int64 `json:"id"`
GroupID int64 `json:"group_id"`
Name string `json:"name"`
RotationOrder *int `json:"rotation_order,omitempty"` // NULL for non-rotating
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
WorkoutVariant represents a workout variant (Day A, B, C, D or Default)