Skip to main content

MealPlannerStore

Struct MealPlannerStore 

Source
pub struct MealPlannerStore { /* private fields */ }
Expand description

Shared SQLite connection for Meal Planner persistence operations.

Implementations§

Source§

impl MealPlannerStore

Source

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.

Source

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>

Source

pub fn set_meal_exception_for_family( &self, family_id: &str, member_id: i64, date: NaiveDate, meal_type: MealType, arrangement: MealArrangement, ) -> Result<MealException, MealPlannerError>

Source

pub fn create_family_member( &self, name: &str, ) -> Result<FamilyMember, MealPlannerError>

Source

pub fn rename_family_member( &self, id: i64, name: &str, ) -> Result<FamilyMember, MealPlannerError>

Source

pub fn list_family_members_for_family( &self, family_id: &str, ) -> Result<Vec<FamilyMember>, MealPlannerError>

Source

pub fn list_family_members(&self) -> Result<Vec<FamilyMember>, MealPlannerError>

Source

pub fn deactivate_family_member(&self, id: i64) -> Result<(), MealPlannerError>

Source

pub fn delete_family_member(&self, id: i64) -> Result<(), MealPlannerError>

Source

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>

Source

pub fn list_recurring_rules( &self, member_id: Option<i64>, ) -> Result<Vec<RecurringParticipationRule>, MealPlannerError>

Source

pub fn delete_recurring_rule(&self, id: i64) -> Result<(), MealPlannerError>

Source

pub fn set_meal_exception( &self, member_id: i64, date: NaiveDate, meal_type: MealType, arrangement: MealArrangement, ) -> Result<MealException, MealPlannerError>

Source

pub fn delete_meal_exception( &self, member_id: i64, date: NaiveDate, meal_type: MealType, ) -> Result<(), MealPlannerError>

Source

pub fn resolve_meal_date( &self, date: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>

Source

pub fn resolve_meal_week( &self, start: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>

Source

pub fn resolve_meal_week_for_family( &self, family_id: &str, start: NaiveDate, ) -> Result<Vec<MealParticipation>, MealPlannerError>

Source§

impl MealPlannerStore

Source

pub fn create_weekly_plan_from_rules_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<WeeklyPlan, MealPlannerError>

Source

pub fn create_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>

Source

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.

Source

pub fn get_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<Option<WeeklyPlan>, MealPlannerError>

Source

pub fn list_weekly_plans_for_family( &self, family_id: &str, from: NaiveDate, to: NaiveDate, ) -> Result<Vec<WeeklyPlan>, MealPlannerError>

Source

pub fn update_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>

Source

pub fn delete_weekly_plan_for_family( &self, family_id: &str, week_start: NaiveDate, ) -> Result<(), MealPlannerError>

Source

pub fn plan_belongs_to_family( &self, plan_id: i64, family_id: &str, ) -> Result<bool, MealPlannerError>

Source

pub fn create_weekly_plan( &self, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>

Source

pub fn get_weekly_plan( &self, week_start: NaiveDate, ) -> Result<Option<WeeklyPlan>, MealPlannerError>

Source

pub fn update_weekly_plan( &self, week_start: NaiveDate, draft: WeeklyPlanDraft, ) -> Result<WeeklyPlan, MealPlannerError>

Source

pub fn create_weekly_plan_from_rules( &self, week_start: NaiveDate, ) -> Result<WeeklyPlan, MealPlannerError>

Source§

impl MealPlannerStore

Source

pub fn create_recipe( &self, owner_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>

Source

pub fn update_recipe( &self, id: i64, owner_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>

Source

pub fn get_recipe( &self, id: i64, owner_id: &str, families: &[String], ) -> Result<Recipe, MealPlannerError>

Source

pub fn list_recipes( &self, owner_id: &str, families: &[String], query: Option<&str>, ) -> Result<Vec<Recipe>, MealPlannerError>

Source

pub fn update_recipe_for_family( &self, id: i64, owner_id: &str, family_id: &str, draft: RecipeDraft, ) -> Result<Recipe, MealPlannerError>

Source

pub fn delete_recipe_for_family( &self, id: i64, owner_id: &str, family_id: &str, ) -> Result<(), MealPlannerError>

Source

pub fn delete_recipe( &self, id: i64, owner_id: &str, ) -> Result<(), MealPlannerError>

Source§

impl MealPlannerStore

Source§

impl MealPlannerStore

Source§

impl MealPlannerStore

Source

pub fn open(config: &MealPlannerConfig) -> Result<Self, MealPlannerError>

Open the configured database, creating its parent directory if necessary.

Source

pub fn open_in_memory() -> Result<Self, MealPlannerError>

Create an isolated in-memory database for tests.

Source

pub fn health_check(&self) -> Result<(), MealPlannerError>

Source

pub fn schema_version(&self) -> Result<i64, MealPlannerError>

Trait Implementations§

Source§

impl Clone for MealPlannerStore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more