| 1 |
|
| 2 |
|
| 3 |
use chrono::{DateTime, Utc}; |
| 4 |
use serde::Serialize; |
| 5 |
use sqlx::FromRow; |
| 6 |
|
| 7 |
use super::super::id_types::*; |
| 8 |
|
| 9 |
|
| 10 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 11 |
pub struct DbPromoCode { |
| 12 |
|
| 13 |
pub id: PromoCodeId, |
| 14 |
|
| 15 |
pub creator_id: UserId, |
| 16 |
|
| 17 |
pub code: String, |
| 18 |
|
| 19 |
pub code_purpose: super::super::CodePurpose, |
| 20 |
|
| 21 |
pub discount_type: Option<super::super::DiscountType>, |
| 22 |
|
| 23 |
pub discount_value: Option<i32>, |
| 24 |
|
| 25 |
pub min_price_cents: i32, |
| 26 |
|
| 27 |
pub trial_days: Option<i32>, |
| 28 |
|
| 29 |
pub item_id: Option<ItemId>, |
| 30 |
|
| 31 |
pub project_id: Option<ProjectId>, |
| 32 |
|
| 33 |
pub tier_id: Option<SubscriptionTierId>, |
| 34 |
|
| 35 |
pub max_uses: Option<i32>, |
| 36 |
|
| 37 |
pub use_count: i32, |
| 38 |
|
| 39 |
pub expires_at: Option<DateTime<Utc>>, |
| 40 |
|
| 41 |
pub starts_at: Option<DateTime<Utc>>, |
| 42 |
|
| 43 |
pub created_at: DateTime<Utc>, |
| 44 |
|
| 45 |
pub is_platform_wide: bool, |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
#[derive(Debug, Clone, FromRow)] |
| 50 |
pub struct DbPromoCodeWithNames { |
| 51 |
pub id: PromoCodeId, |
| 52 |
pub creator_id: UserId, |
| 53 |
pub code: String, |
| 54 |
pub code_purpose: super::super::CodePurpose, |
| 55 |
pub discount_type: Option<super::super::DiscountType>, |
| 56 |
pub discount_value: Option<i32>, |
| 57 |
pub min_price_cents: i32, |
| 58 |
pub trial_days: Option<i32>, |
| 59 |
pub item_id: Option<ItemId>, |
| 60 |
pub project_id: Option<ProjectId>, |
| 61 |
pub tier_id: Option<SubscriptionTierId>, |
| 62 |
pub max_uses: Option<i32>, |
| 63 |
pub use_count: i32, |
| 64 |
pub expires_at: Option<DateTime<Utc>>, |
| 65 |
pub starts_at: Option<DateTime<Utc>>, |
| 66 |
pub created_at: DateTime<Utc>, |
| 67 |
|
| 68 |
pub is_platform_wide: bool, |
| 69 |
|
| 70 |
pub item_title: Option<String>, |
| 71 |
|
| 72 |
pub project_title: Option<String>, |
| 73 |
} |
| 74 |
|