| 1 |
|
| 2 |
|
| 3 |
use chrono::{DateTime, Utc}; |
| 4 |
use serde::Serialize; |
| 5 |
use sqlx::FromRow; |
| 6 |
|
| 7 |
use super::super::id_types::*; |
| 8 |
use super::super::validated_types::Cents; |
| 9 |
|
| 10 |
|
| 11 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 12 |
pub struct DbTip { |
| 13 |
pub id: TipId, |
| 14 |
pub tipper_id: UserId, |
| 15 |
pub recipient_id: UserId, |
| 16 |
pub project_id: Option<ProjectId>, |
| 17 |
pub amount_cents: Cents, |
| 18 |
pub message: Option<String>, |
| 19 |
pub status: super::super::TransactionStatus, |
| 20 |
pub stripe_payment_intent_id: Option<String>, |
| 21 |
pub stripe_checkout_session_id: Option<String>, |
| 22 |
pub stripe_transfer_group: Option<String>, |
| 23 |
pub created_at: DateTime<Utc>, |
| 24 |
pub completed_at: Option<DateTime<Utc>>, |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 29 |
pub struct DbProjectMember { |
| 30 |
pub id: ProjectMemberId, |
| 31 |
pub project_id: ProjectId, |
| 32 |
pub user_id: UserId, |
| 33 |
pub role: super::super::ProjectRole, |
| 34 |
pub split_percent: i16, |
| 35 |
pub added_at: DateTime<Utc>, |
| 36 |
pub added_by: UserId, |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
#[derive(Debug, Clone, FromRow, Serialize)] |
| 41 |
pub struct DbRevenueSplit { |
| 42 |
pub id: RevenueSplitId, |
| 43 |
pub tip_id: Option<TipId>, |
| 44 |
pub transaction_id: Option<TransactionId>, |
| 45 |
pub recipient_id: UserId, |
| 46 |
pub amount_cents: Cents, |
| 47 |
pub split_percent: i16, |
| 48 |
pub stripe_transfer_id: Option<String>, |
| 49 |
pub status: super::super::TransactionStatus, |
| 50 |
pub created_at: DateTime<Utc>, |
| 51 |
pub completed_at: Option<DateTime<Utc>>, |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
#[derive(Debug, Clone, FromRow)] |
| 56 |
pub struct DbTipWithUser { |
| 57 |
pub id: TipId, |
| 58 |
pub tipper_id: UserId, |
| 59 |
pub recipient_id: UserId, |
| 60 |
pub project_id: Option<ProjectId>, |
| 61 |
pub amount_cents: Cents, |
| 62 |
pub message: Option<String>, |
| 63 |
pub status: super::super::TransactionStatus, |
| 64 |
pub created_at: DateTime<Utc>, |
| 65 |
pub completed_at: Option<DateTime<Utc>>, |
| 66 |
pub tipper_username: String, |
| 67 |
pub tipper_display_name: Option<String>, |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
#[derive(Debug, Clone, FromRow)] |
| 72 |
pub struct DbProjectMemberWithUser { |
| 73 |
pub id: ProjectMemberId, |
| 74 |
pub project_id: ProjectId, |
| 75 |
pub user_id: UserId, |
| 76 |
pub role: super::super::ProjectRole, |
| 77 |
pub split_percent: i16, |
| 78 |
pub added_at: DateTime<Utc>, |
| 79 |
pub username: String, |
| 80 |
pub display_name: Option<String>, |
| 81 |
pub stripe_account_id: Option<String>, |
| 82 |
pub stripe_charges_enabled: bool, |
| 83 |
} |
| 84 |
|