use super::*;
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct User {
pub username: String,
pub name: Option<String>,
pub email: Option<String>,
pub email_verified: Option<bool>,
pub has_password: Option<bool>,
pub has_totp: Option<bool>,
pub auth_providers: Option<Vec<AuthProvider>>,
pub bio: Option<String>,
pub payout_data: Option<PayoutData>,
pub id: ID,
pub avatar_url: Option<Url>,
pub created: UtcTime,
pub role: UserRole,
pub badges: Int,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct PayoutData {
pub balance: f64,
pub paypal_address: Option<String>,
pub paypal_country: Option<String>,
pub venmo_handle: Option<String>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TeamMember {
pub team_id: ID,
pub user: User,
pub role: String,
pub permissions: Option<Int>,
pub accepted: bool,
pub payouts_split: Option<f64>,
pub ordering: Int,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Notification {
pub id: ID,
pub user_id: ID,
pub title: String,
pub text: String,
pub link: String,
pub read: bool,
pub created: UtcTime,
pub actions: Vec<NotificationAction>,
pub body: NotificationBody,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NotificationAction {
pub title: String,
pub action_route: (String, String),
}
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum NotificationBody {
ProjectUpdate {
project_id: ID,
version_id: ID,
},
TeamInvite {
project_id: ID,
team_id: ID,
invited_by: ID,
role: String,
},
OrganizationInvite {
organization_id: ID,
invited_by: ID,
team_id: ID,
role: String,
},
StatusChange {
project_id: ID,
old_status: project::ProjectStatus,
new_status: project::ProjectStatus,
},
ModeratorMessage {
thread_id: ID,
message_id: ID,
project_id: Option<ID>,
report_id: Option<ID>,
},
LegacyMarkdown {
notification_type: Option<String>,
title: String,
text: String,
link: String,
actions: Vec<NotificationAction>,
},
Unknown,
}
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum UserRole {
Developer,
Moderator,
Admin,
}
#[derive(Deserialize, Serialize, Debug, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum AuthProvider {
GitHub,
Discord,
Microsoft,
GitLab,
Google,
Steam,
PayPal,
}