Introduce 6-step onboarding screen (Goal → Gender → DOB → Height+Weight → Activity → Calories) with per-step accent colors, hero illustration area (concentric circles + icon), and white card content panel. Backend user entity and service updated to support onboarding fields (goal, activity, height, weight, DOB, dailyCalories). Router guards unauthenticated and onboarding-incomplete users. Profile service and screen updated to expose language and onboarding preferences. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
package user
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
FirebaseUID string `json:"-"`
|
|
Email string `json:"email"`
|
|
Name string `json:"name"`
|
|
AvatarURL *string `json:"avatar_url"`
|
|
HeightCM *int `json:"height_cm"`
|
|
WeightKG *float64 `json:"weight_kg"`
|
|
DateOfBirth *string `json:"date_of_birth"`
|
|
Gender *string `json:"gender"`
|
|
Activity *string `json:"activity"`
|
|
Goal *string `json:"goal"`
|
|
DailyCalories *int `json:"daily_calories"`
|
|
Plan string `json:"plan"`
|
|
Preferences json.RawMessage `json:"preferences"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type UpdateProfileRequest struct {
|
|
Name *string `json:"name"`
|
|
HeightCM *int `json:"height_cm"`
|
|
WeightKG *float64 `json:"weight_kg"`
|
|
DateOfBirth *string `json:"date_of_birth"`
|
|
Gender *string `json:"gender"`
|
|
Activity *string `json:"activity"`
|
|
Goal *string `json:"goal"`
|
|
Preferences *json.RawMessage `json:"preferences"`
|
|
DailyCalories *int `json:"daily_calories,omitempty"`
|
|
}
|
|
|
|
// HasBodyParams returns true if any body parameter is being updated
|
|
// that would require recalculation of daily calories.
|
|
func (r *UpdateProfileRequest) HasBodyParams() bool {
|
|
return r.HeightCM != nil || r.WeightKG != nil || r.DateOfBirth != nil ||
|
|
r.Gender != nil || r.Activity != nil || r.Goal != nil
|
|
}
|