pub struct SqlitePromotionRepository { /* private fields */ }Available on crate feature
sqlite only.Implementations§
Source§impl SqlitePromotionRepository
impl SqlitePromotionRepository
pub const fn new(pool: Pool<SqliteConnectionManager>) -> Self
pub fn create(&self, input: CreatePromotion) -> Result<Promotion>
pub fn get(&self, id: PromotionId) -> Result<Option<Promotion>>
pub fn get_by_code(&self, code: &str) -> Result<Option<Promotion>>
pub fn list(&self, filter: PromotionFilter) -> Result<Vec<Promotion>>
pub fn update( &self, id: PromotionId, input: UpdatePromotion, ) -> Result<Promotion>
pub fn delete(&self, id: PromotionId) -> Result<()>
pub fn activate(&self, id: PromotionId) -> Result<Promotion>
pub fn deactivate(&self, id: PromotionId) -> Result<Promotion>
pub fn create_coupon(&self, input: CreateCouponCode) -> Result<CouponCode>
pub fn get_coupon(&self, id: Uuid) -> Result<Option<CouponCode>>
pub fn get_coupon_by_code(&self, code: &str) -> Result<Option<CouponCode>>
pub fn list_coupons(&self, filter: CouponFilter) -> Result<Vec<CouponCode>>
pub fn apply_promotions( &self, request: ApplyPromotionsRequest, ) -> Result<ApplyPromotionsResult>
pub fn record_usage( &self, promotion_id: PromotionId, coupon_id: Option<Uuid>, customer_id: Option<CustomerId>, order_id: Option<OrderId>, cart_id: Option<CartId>, discount_amount: Decimal, currency: &str, ) -> Result<PromotionUsage>
Trait Implementations§
Source§impl Debug for SqlitePromotionRepository
impl Debug for SqlitePromotionRepository
Source§impl PromotionRepository for SqlitePromotionRepository
impl PromotionRepository for SqlitePromotionRepository
Source§fn list(&self, filter: PromotionFilter) -> Result<Vec<Promotion>>
fn list(&self, filter: PromotionFilter) -> Result<Vec<Promotion>>
List promotions matching a filter
Source§fn update(&self, id: PromotionId, input: UpdatePromotion) -> Result<Promotion>
fn update(&self, id: PromotionId, input: UpdatePromotion) -> Result<Promotion>
Update a promotion
Source§fn deactivate(&self, id: PromotionId) -> Result<Promotion>
fn deactivate(&self, id: PromotionId) -> Result<Promotion>
Deactivate a promotion
Source§fn create_coupon(&self, input: CreateCouponCode) -> Result<CouponCode>
fn create_coupon(&self, input: CreateCouponCode) -> Result<CouponCode>
Create a coupon code
Source§fn get_coupon(&self, id: Uuid) -> Result<Option<CouponCode>>
fn get_coupon(&self, id: Uuid) -> Result<Option<CouponCode>>
Get a coupon by ID
Source§fn get_coupon_by_code(&self, code: &str) -> Result<Option<CouponCode>>
fn get_coupon_by_code(&self, code: &str) -> Result<Option<CouponCode>>
Get a coupon by code
Source§fn list_coupons(&self, filter: CouponFilter) -> Result<Vec<CouponCode>>
fn list_coupons(&self, filter: CouponFilter) -> Result<Vec<CouponCode>>
List coupons matching a filter
Source§fn apply_promotions(
&self,
request: ApplyPromotionsRequest,
) -> Result<ApplyPromotionsResult>
fn apply_promotions( &self, request: ApplyPromotionsRequest, ) -> Result<ApplyPromotionsResult>
Apply promotions to a cart or order snapshot
Source§fn record_usage(
&self,
promotion_id: PromotionId,
coupon_id: Option<Uuid>,
customer_id: Option<CustomerId>,
order_id: Option<OrderId>,
cart_id: Option<CartId>,
discount_amount: Decimal,
currency: &str,
) -> Result<PromotionUsage>
fn record_usage( &self, promotion_id: PromotionId, coupon_id: Option<Uuid>, customer_id: Option<CustomerId>, order_id: Option<OrderId>, cart_id: Option<CartId>, discount_amount: Decimal, currency: &str, ) -> Result<PromotionUsage>
Record a promotion usage event
Auto Trait Implementations§
impl !RefUnwindSafe for SqlitePromotionRepository
impl !UnwindSafe for SqlitePromotionRepository
impl Freeze for SqlitePromotionRepository
impl Send for SqlitePromotionRepository
impl Sync for SqlitePromotionRepository
impl Unpin for SqlitePromotionRepository
impl UnsafeUnpin for SqlitePromotionRepository
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