Backend:
- Add Groq LLM client (llama-3.3-70b) for recipe generation with JSON
retry strategy (retries only on parse errors, not API errors)
- Add Pexels client for parallel photo search per recipe
- Add saved_recipes table (migration 004) with JSONB fields
- Add GET /recommendations endpoint (profile-aware prompt building)
- Add POST/GET/GET{id}/DELETE /saved-recipes CRUD endpoints
- Wire gemini, pexels, recommendation, savedrecipe packages in main.go
Flutter:
- Add Recipe, SavedRecipe models with json_serializable
- Add RecipeService (getRecommendations, getSavedRecipes, save, delete)
- Add RecommendationsNotifier and SavedRecipesNotifier (Riverpod)
- Add RecommendationsScreen with skeleton loading and refresh FAB
- Add RecipeDetailScreen (SliverAppBar, nutrition tooltip, steps with timer)
- Add SavedRecipesScreen with Dismissible swipe-to-delete and empty state
- Update RecipesScreen to TabBar (Recommendations / Saved)
- Add /recipe-detail route outside ShellRoute (no bottom nav)
- Extend ApiClient with getList() and deleteVoid()
Project:
- Add CLAUDE.md with English-only rule for comments and commit messages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package recipe
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Recipe is a recipe record in the database.
|
|
type Recipe struct {
|
|
ID string `json:"id"`
|
|
Source string `json:"source"` // spoonacular | ai | user
|
|
SpoonacularID *int `json:"spoonacular_id"`
|
|
|
|
Title string `json:"title"`
|
|
TitleRu *string `json:"title_ru"`
|
|
Description *string `json:"description"`
|
|
DescriptionRu *string `json:"description_ru"`
|
|
|
|
Cuisine *string `json:"cuisine"`
|
|
Difficulty *string `json:"difficulty"` // easy | medium | hard
|
|
PrepTimeMin *int `json:"prep_time_min"`
|
|
CookTimeMin *int `json:"cook_time_min"`
|
|
Servings *int `json:"servings"`
|
|
ImageURL *string `json:"image_url"`
|
|
|
|
CaloriesPerServing *float64 `json:"calories_per_serving"`
|
|
ProteinPerServing *float64 `json:"protein_per_serving"`
|
|
FatPerServing *float64 `json:"fat_per_serving"`
|
|
CarbsPerServing *float64 `json:"carbs_per_serving"`
|
|
FiberPerServing *float64 `json:"fiber_per_serving"`
|
|
|
|
Ingredients json.RawMessage `json:"ingredients"` // []RecipeIngredient
|
|
Steps json.RawMessage `json:"steps"` // []RecipeStep
|
|
Tags json.RawMessage `json:"tags"` // []string
|
|
|
|
AvgRating float64 `json:"avg_rating"`
|
|
ReviewCount int `json:"review_count"`
|
|
CreatedBy *string `json:"created_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// RecipeIngredient is a single ingredient in a recipe's JSONB array.
|
|
type RecipeIngredient struct {
|
|
SpoonacularID *int `json:"spoonacular_id"`
|
|
MappingID *string `json:"mapping_id"`
|
|
Name string `json:"name"`
|
|
NameRu *string `json:"name_ru"`
|
|
Amount float64 `json:"amount"`
|
|
Unit string `json:"unit"`
|
|
UnitRu *string `json:"unit_ru"`
|
|
Optional bool `json:"optional"`
|
|
}
|
|
|
|
// RecipeStep is a single step in a recipe's JSONB array.
|
|
type RecipeStep struct {
|
|
Number int `json:"number"`
|
|
Description string `json:"description"`
|
|
DescriptionRu *string `json:"description_ru"`
|
|
TimerSeconds *int `json:"timer_seconds"`
|
|
ImageURL *string `json:"image_url"`
|
|
}
|