mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 01:54:47 +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,12 +1,12 @@
|
||||
use super::DatabaseError;
|
||||
use crate::database::PgTransaction;
|
||||
use crate::models::ids::{
|
||||
AffiliateCodeId, AnalyticsEventId, ChargeId, CollectionId, FileId, ImageId,
|
||||
NotificationId, OAuthAccessTokenId, OAuthClientAuthorizationId,
|
||||
OAuthClientId, OAuthRedirectUriId, OrganizationId, PatId, PayoutId,
|
||||
ProductId, ProductPriceId, ProjectId, ReportId, SessionId,
|
||||
SharedInstanceId, SharedInstanceVersionId, TeamId, TeamMemberId, ThreadId,
|
||||
ThreadMessageId, UserSubscriptionId, VersionId,
|
||||
AffiliateCodeId, AnalyticsEventId, CampaignDonationId, ChargeId,
|
||||
CollectionId, FileId, ImageId, NotificationId, OAuthAccessTokenId,
|
||||
OAuthClientAuthorizationId, OAuthClientId, OAuthRedirectUriId,
|
||||
OrganizationId, PatId, PayoutId, ProductId, ProductPriceId, ProjectId,
|
||||
ReportId, SessionId, SharedInstanceId, SharedInstanceVersionId, TeamId,
|
||||
TeamMemberId, ThreadId, ThreadMessageId, UserSubscriptionId, VersionId,
|
||||
};
|
||||
use ariadne::ids::base62_impl::to_base62;
|
||||
use ariadne::ids::{UserId, random_base62_rng, random_base62_rng_range};
|
||||
@@ -164,6 +164,10 @@ db_id_interface!(
|
||||
ChargeId,
|
||||
generator: generate_charge_id @ "charges",
|
||||
);
|
||||
db_id_interface!(
|
||||
CampaignDonationId,
|
||||
generator: generate_campaign_donation_id @ "campaign_donations",
|
||||
);
|
||||
db_id_interface!(
|
||||
CollectionId,
|
||||
generator: generate_collection_id @ "collections",
|
||||
|
||||
@@ -48,6 +48,8 @@ pub struct DBUser {
|
||||
pub created: DateTime<Utc>,
|
||||
pub role: String,
|
||||
pub badges: Badges,
|
||||
#[serde(default)]
|
||||
pub campaign_pride_26: Option<DateTime<Utc>>,
|
||||
|
||||
pub allow_friend_requests: bool,
|
||||
|
||||
@@ -180,6 +182,12 @@ impl DBUser {
|
||||
SELECT id, email,
|
||||
avatar_url, raw_avatar_url, username, bio,
|
||||
created, role, badges,
|
||||
(
|
||||
SELECT MAX(campaign_donations.donated_at)
|
||||
FROM campaign_donations
|
||||
WHERE campaign_donations.user_id = users.id
|
||||
AND campaign_donations.amount_usd > 5
|
||||
) AS campaign_pride_26,
|
||||
github_id, discord_id, gitlab_id, google_id, steam_id, microsoft_id,
|
||||
email_verified, password, totp_secret, paypal_id, paypal_country, paypal_email,
|
||||
venmo_handle, stripe_customer_id, allow_friend_requests, is_subscribed_to_newsletter
|
||||
@@ -208,6 +216,7 @@ impl DBUser {
|
||||
created: u.created,
|
||||
role: u.role,
|
||||
badges: Badges::from_bits(u.badges as u64).unwrap_or_default(),
|
||||
campaign_pride_26: u.campaign_pride_26,
|
||||
password: u.password,
|
||||
paypal_id: u.paypal_id,
|
||||
paypal_country: u.paypal_country,
|
||||
|
||||
Reference in New Issue
Block a user