You've already forked AstralRinth
forked from didirus/AstralRinth
Payouts finish (#470)
* Almost done * More work on midas * Finish payouts backend * Update Cargo.lock * Run fmt + prepare
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use super::ids::Base62Id;
|
||||
use crate::database::models::team_item::QueryTeamMember;
|
||||
use crate::models::users::User;
|
||||
use rust_decimal::Decimal;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The ID of a team
|
||||
@@ -59,9 +60,11 @@ pub struct TeamMember {
|
||||
pub permissions: Option<Permissions>,
|
||||
/// Whether the user has joined the team or is just invited to it
|
||||
pub accepted: bool,
|
||||
|
||||
#[serde(with = "rust_decimal::serde::float_option")]
|
||||
/// Payouts split. This is a weighted average. For example. if a team has two members with this
|
||||
/// value set to 25.0 for both members, they split revenue 50/50
|
||||
pub payouts_split: Option<f32>,
|
||||
pub payouts_split: Option<Decimal>,
|
||||
}
|
||||
|
||||
impl TeamMember {
|
||||
|
||||
@@ -13,6 +13,7 @@ bitflags::bitflags! {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct Badges: u64 {
|
||||
// 1 << 0 unused - ignore + replace with something later
|
||||
const MIDAS = 1 << 0;
|
||||
const EARLY_MODPACK_ADOPTER = 1 << 1;
|
||||
const EARLY_RESPACK_ADOPTER = 1 << 2;
|
||||
@@ -44,6 +45,7 @@ pub struct User {
|
||||
pub created: DateTime<Utc>,
|
||||
pub role: Role,
|
||||
pub badges: Badges,
|
||||
pub paypal_email: Option<String>,
|
||||
}
|
||||
|
||||
use crate::database::models::user_item::User as DBUser;
|
||||
@@ -60,6 +62,7 @@ impl From<DBUser> for User {
|
||||
created: data.created,
|
||||
role: Role::from_string(&*data.role),
|
||||
badges: data.badges,
|
||||
paypal_email: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user