This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83ab67d
commit 7a144f3
Showing
25 changed files
with
491 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Legacy models from V2, where its useful to keep the struct for rerouting/conversion | ||
pub mod projects; | ||
pub mod notifications; | ||
pub mod teams; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use rust_decimal::Decimal; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::models::{ids::TeamId, users::User, teams::{ProjectPermissions, OrganizationPermissions, TeamMember}}; | ||
|
||
/// A member of a team | ||
#[derive(Serialize, Deserialize, Clone)] | ||
pub struct LegacyTeamMember { | ||
pub role: String, | ||
// is_owner removed, and role hardcoded to Owner if true, | ||
|
||
pub team_id: TeamId, | ||
pub user: User, | ||
pub permissions: Option<ProjectPermissions>, | ||
pub organization_permissions: Option<OrganizationPermissions>, // TODO: technically not a v2 field, should it be kept? | ||
pub accepted: bool, | ||
|
||
#[serde(with = "rust_decimal::serde::float_option")] | ||
pub payouts_split: Option<Decimal>, | ||
pub ordering: i64, | ||
} | ||
|
||
impl LegacyTeamMember { | ||
pub fn from(team_member : TeamMember) -> Self { | ||
LegacyTeamMember { | ||
role: match (team_member.is_owner, team_member.role.as_str()) { | ||
(true, _) => "Owner".to_string(), | ||
(false, "Owner") => "Member".to_string(), // The odd case of a non-owner with the owner role should show as 'Member' | ||
(false, role) => role.to_string(), | ||
}, | ||
team_id: team_member.team_id, | ||
user: team_member.user, | ||
permissions: team_member.permissions, | ||
organization_permissions: team_member.organization_permissions, | ||
accepted: team_member.accepted, | ||
payouts_split: team_member.payouts_split, | ||
ordering: team_member.ordering, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.