mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 02:24:56 +00:00
Pride 26 campaign backend integration (#6254)
* wip: pride 2026 webhooks and stuff * setup webhook and link to user * fix up code * improve donation resolution * Pride 26 campaign * idempotency * wip: tiltify * fix * redis caching * add num donators * fix * Revert openapi * Prepare * improve oauth token gen code
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use ariadne::ids::base62_id;
|
||||
|
||||
base62_id!(ChargeId);
|
||||
base62_id!(CampaignDonationId);
|
||||
base62_id!(CollectionId);
|
||||
base62_id!(FileId);
|
||||
base62_id!(ImageId);
|
||||
|
||||
@@ -56,6 +56,7 @@ pub struct User {
|
||||
pub created: DateTime<Utc>,
|
||||
pub role: Role,
|
||||
pub badges: Badges,
|
||||
pub campaigns: UserCampaigns,
|
||||
|
||||
pub auth_providers: Option<Vec<AuthProvider>>,
|
||||
pub email: Option<String>,
|
||||
@@ -72,6 +73,11 @@ pub struct User {
|
||||
pub github_id: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
||||
pub struct UserCampaigns {
|
||||
pub pride_26: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
||||
pub struct UserPayoutData {
|
||||
pub paypal_address: Option<String>,
|
||||
@@ -94,6 +100,9 @@ impl From<DBUser> for User {
|
||||
created: data.created,
|
||||
role: Role::from_string(&data.role),
|
||||
badges: data.badges,
|
||||
campaigns: UserCampaigns {
|
||||
pride_26: data.campaign_pride_26,
|
||||
},
|
||||
payout_data: None,
|
||||
auth_providers: None,
|
||||
has_password: None,
|
||||
@@ -142,6 +151,9 @@ impl User {
|
||||
created: db_user.created,
|
||||
role: Role::from_string(&db_user.role),
|
||||
badges: db_user.badges,
|
||||
campaigns: UserCampaigns {
|
||||
pride_26: db_user.campaign_pride_26,
|
||||
},
|
||||
auth_providers: Some(auth_providers),
|
||||
has_password: Some(db_user.password.is_some()),
|
||||
has_totp: Some(db_user.totp_secret.is_some()),
|
||||
|
||||
Reference in New Issue
Block a user