add reward card feature with barcodes
This commit is contained in:
+25
-1
@@ -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<()>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user