pub struct MealPlannerStore { /* private fields */ }Expand description
Shared SQLite connection for Meal Planner persistence operations.
Implementations§
Source§impl MealPlannerStore
impl MealPlannerStore
Sourcepub fn sync_family_members(
&self,
family_id: &str,
members: &[(String, String)],
) -> Result<Vec<FamilyMember>, MealPlannerError>
pub fn sync_family_members( &self, family_id: &str, members: &[(String, String)], ) -> Result<Vec<FamilyMember>, MealPlannerError>
Refresh the local numeric member keys from the authoritative family membership list. External IDs are stable UserIds; names are snapshots.
pub fn add_recurring_rule_for_family( &self, family_id: &str, member_id: i64, weekday: MealWeekday, meal_type: MealType, arrangement: MealArrangement, effective_from: Option<NaiveDate>, effective_until: Option<NaiveDate>, ) -> Result<RecurringParticipationRule, MealPlannerError>
pub fn set_meal_exception_for_family( &self, family_id: &str, member_id: i64, date: NaiveDate, meal_type: MealType, arrangement: MealArrangement, ) -> Result<MealException, MealPlannerError>
pub fn create_family_member( &self, name: &str, ) -> Result<FamilyMember, MealPlannerError>
pub fn rename_family_member( &self, id: i64, name: &str, ) -> Result<FamilyMember, MealPlannerError>
pub fn list_family_members_for_family( &self, family_id: &str, ) -> Result<Vec<FamilyMember>, MealPlannerError>
pub fn list_family_members(&self) -> Result<Vec<FamilyMember>, MealPlannerError>
pub fn deactivate_family_member(&self, id: i64) -> Result<(), MealPlannerError>
pub fn delete_family_member(&self, id: i64) -> Result<(), MealPlannerError>
pub fn add_recurring_rule( &self, member_id: i64, weekday: MealWeekday, meal_type: MealType, arrangement: MealArrangement, effective_from: Option<NaiveDate>, effective_until: Option<NaiveDate>, ) -> Result<RecurringParticipationRule, MealPlannerError>
pub fn list_recurring_rules( &self, member_id: Option<i64>, ) -> Result<Vec<RecurringParticipationRule>, MealPlannerError>
pub fn delete_recurring_rule(&self, id: i64) -> Result<(), MealPlannerError>
pub fn set_meal_exception( &self, member_id: i64, date: NaiveDate, meal_type: MealType, arrangement: MealArrangement, ) -> Result<MealException, MealPlannerError>
pub fn delete_meal_exception( &self, member_id: i64, date: NaiveDate, meal_type: MealType, ) -> Result<(), MealPlannerError>
pub fn resolve_meal_date( &self, date: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>
pub fn resolve_meal_week( &self, start: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>
pub fn resolve_meal_week_for_family( &self, family_id: &str, start: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>
Source§impl MealPlannerStore
impl MealPlannerStore
pub fn create_weekly_plan_from_rules_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<WeeklyPlan, MealPlannerError>
pub fn create_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>
Sourcepub fn save_weekly_plan_for_family(
&self,
family_id: &str,
week_start: NaiveDate,
draft: WeeklyPlanDraft,
) -> Result<WeeklyPlan, MealPlannerError>
pub fn save_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>
Create or replace a family’s weekly plan in one atomic operation. Repeating the same save is safe and does not create duplicate plans.
pub fn get_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<Option<WeeklyPlan>, MealPlannerError>
pub fn list_weekly_plans_for_family( &self, family_id: &str, from: NaiveDate, to: NaiveDate, ) -> Result<Vec<WeeklyPlan>, MealPlannerError>
pub fn update_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>
pub fn delete_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<(), MealPlannerError>
pub fn plan_belongs_to_family( &self, plan_id: i64, family_id: &str, ) -> Result<bool, MealPlannerError>
pub fn create_weekly_plan( &self, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>
pub fn get_weekly_plan( &self, week_start: NaiveDate, ) -> Result<Option<WeeklyPlan>, MealPlannerError>
pub fn update_weekly_plan( &self, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>
pub fn create_weekly_plan_from_rules( &self, week_start: NaiveDate, ) -> Result<WeeklyPlan, MealPlannerError>
Source§impl MealPlannerStore
impl MealPlannerStore
pub fn create_recipe( &self, owner_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>
pub fn update_recipe( &self, id: i64, owner_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>
pub fn get_recipe( &self, id: i64, owner_id: &str, families: &[String], ) -> Result<Recipe, MealPlannerError>
pub fn list_recipes( &self, owner_id: &str, families: &[String], query: Option<&str>, ) -> Result<Vec<Recipe>, MealPlannerError>
pub fn update_recipe_for_family( &self, id: i64, owner_id: &str, family_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>
pub fn delete_recipe_for_family( &self, id: i64, owner_id: &str, family_id: &str, ) -> Result<(), MealPlannerError>
pub fn delete_recipe( &self, id: i64, owner_id: &str, ) -> Result<(), MealPlannerError>
Source§impl MealPlannerStore
impl MealPlannerStore
pub fn generate_shopping_list_for_range( &self, family_id: &str, start: NaiveDate, end: NaiveDate, ) -> Result<ShoppingList, MealPlannerError>
pub fn get_shopping_list_for_range( &self, family_id: &str, start: NaiveDate, end: NaiveDate, ) -> Result<Option<ShoppingList>, MealPlannerError>
pub fn shopping_list_belongs_to_family( &self, id: i64, family_id: &str, ) -> Result<bool, MealPlannerError>
pub fn add_shopping_list_item( &self, list_id: i64, item: NewShoppingListItem, ) -> Result<ShoppingList, MealPlannerError>
pub fn update_shopping_list_item( &self, list_id: i64, item_id: i64, update: ShoppingListItemUpdate, ) -> Result<ShoppingList, MealPlannerError>
pub fn remove_shopping_list_item( &self, list_id: i64, item_id: i64, ) -> Result<ShoppingList, MealPlannerError>
pub fn restore_shopping_list_item( &self, list_id: i64, item_id: i64, ) -> Result<ShoppingList, MealPlannerError>
Source§impl MealPlannerStore
impl MealPlannerStore
Sourcepub fn open(config: &MealPlannerConfig) -> Result<Self, MealPlannerError>
pub fn open(config: &MealPlannerConfig) -> Result<Self, MealPlannerError>
Open the configured database, creating its parent directory if necessary.
Sourcepub fn open_in_memory() -> Result<Self, MealPlannerError>
pub fn open_in_memory() -> Result<Self, MealPlannerError>
Create an isolated in-memory database for tests.
pub fn health_check(&self) -> Result<(), MealPlannerError>
pub fn schema_version(&self) -> Result<i64, MealPlannerError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MealPlannerStore
impl RefUnwindSafe for MealPlannerStore
impl Send for MealPlannerStore
impl Sync for MealPlannerStore
impl Unpin for MealPlannerStore
impl UnsafeUnpin for MealPlannerStore
impl UnwindSafe for MealPlannerStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more