add reward card feature with barcodes

This commit is contained in:
2026-08-08 15:55:18 -04:00
parent ab46e63bf0
commit 975cf38170
13 changed files with 771 additions and 11 deletions
+25 -1
View File
@@ -3,7 +3,7 @@ use sqlx::SqliteConnection;
use crate::domain::{
Category, DomainResult, GroceryList, Item, ListMeal, Meal, MealCategory, MealIngredient,
Passkey, PresenceUser, SessionUser, User,
Passkey, PresenceUser, RewardsCard, SessionUser, User,
};
/// Repositories take `&mut SqliteConnection` (which a `Transaction` derefs to),
@@ -314,3 +314,27 @@ pub enum HubEvent {
ListChanged { list_id: i64, revision: i64 },
PresenceChanged { list_id: i64 },
}
/// Stores and retrieves a user's rewards cards.
#[async_trait]
pub trait RewardsCardRepository: Send + Sync {
async fn list_cards(
&self,
txn: &mut SqliteConnection,
user_id: i64,
) -> DomainResult<Vec<RewardsCard>>;
async fn create_card(
&self,
txn: &mut SqliteConnection,
user_id: i64,
store_name: String,
number: String,
symbology: String,
) -> DomainResult<RewardsCard>;
async fn delete_card(
&self,
txn: &mut SqliteConnection,
user_id: i64,
card_id: i64,
) -> DomainResult<()>;
}