meal categories
ci/woodpecker/push/e2e Pipeline was successful
ci/woodpecker/push/fmt Pipeline failed
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
2026-08-03 21:29:33 -04:00
parent cf6853d71e
commit 3695fc68d6
11 changed files with 680 additions and 67 deletions
+19 -2
View File
@@ -2,8 +2,8 @@ use async_trait::async_trait;
use sqlx::SqliteConnection;
use crate::domain::{
Category, DomainResult, GroceryList, Item, Meal, MealIngredient, Passkey, PresenceUser,
SessionUser, User,
Category, DomainResult, GroceryList, Item, Meal, MealCategory, MealIngredient, Passkey,
PresenceUser, SessionUser, User,
};
/// Repositories take `&mut SqliteConnection` (which a `Transaction` derefs to),
@@ -174,6 +174,21 @@ pub trait InvitationRepository: Send + Sync {
) -> DomainResult<()>;
}
#[async_trait]
pub trait MealCategoryRepository: Send + Sync {
async fn meal_categories(&self, txn: &mut SqliteConnection) -> DomainResult<Vec<MealCategory>>;
async fn create_meal_category(
&self,
txn: &mut SqliteConnection,
name: String,
) -> DomainResult<i64>;
async fn delete_meal_category(
&self,
txn: &mut SqliteConnection,
category_id: i64,
) -> DomainResult<()>;
}
#[async_trait]
pub trait MealRepository: Send + Sync {
async fn create_meal(
@@ -181,6 +196,7 @@ pub trait MealRepository: Send + Sync {
txn: &mut SqliteConnection,
name: String,
description: String,
category_id: Option<i64>,
) -> DomainResult<Meal>;
async fn get_meal(
&self,
@@ -194,6 +210,7 @@ pub trait MealRepository: Send + Sync {
meal_id: i64,
name: String,
description: String,
category_id: Option<i64>,
) -> DomainResult<()>;
async fn delete_meal(&self, txn: &mut SqliteConnection, meal_id: i64) -> DomainResult<()>;
}