Move all business-logic packages from internal/ root into internal/domain/: auth, cuisine, diary, dish, home, ingredient, language, menu, product, recipe, recognition, recommendation, savedrecipe, tag, units, user Rename model.go → entity.go in packages that hold domain entities: diary, dish, home, ingredient, menu, product, recipe, savedrecipe, user Update all import paths accordingly (adapters, infra/server, cmd/server, tests). No logic changes. 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:"-"` // internal, set by service
|
|
}
|
|
|
|
// 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
|
|
}
|