You've already forked AstralRinth
Search test + v3 (#731)
* search patch for accurate loader/gv filtering * backup * basic search test * finished test * incomplete commit; backing up * Working multipat reroute backup * working rough draft v3 * most tests passing * works * search v2 conversion * added some tags.rs v2 conversions * Worked through warnings, unwraps, prints * refactors * new search test * version files changes fixes * redesign to revs * removed old caches * removed games * fmt clippy * merge conflicts * fmt, prepare * moved v2 routes over to v3 * fixes; tests passing * project type changes * moved files over * fmt, clippy, prepare, etc * loaders to loader_fields, added tests * fmt, clippy, prepare * fixed sorting bug * reversed back- wrong order for consistency * fmt; clippy; prepare --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
49
src/models/v3/organizations.rs
Normal file
49
src/models/v3/organizations.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use super::{
|
||||
ids::{Base62Id, TeamId},
|
||||
teams::TeamMember,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The ID of a team
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
#[serde(into = "Base62Id")]
|
||||
pub struct OrganizationId(pub u64);
|
||||
|
||||
/// An organization of users who control a project
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Organization {
|
||||
/// The id of the organization
|
||||
pub id: OrganizationId,
|
||||
/// The title (and slug) of the organization
|
||||
pub title: String,
|
||||
/// The associated team of the organization
|
||||
pub team_id: TeamId,
|
||||
/// The description of the organization
|
||||
pub description: String,
|
||||
|
||||
/// The icon url of the organization
|
||||
pub icon_url: Option<String>,
|
||||
/// The color of the organization (picked from the icon)
|
||||
pub color: Option<u32>,
|
||||
|
||||
/// A list of the members of the organization
|
||||
pub members: Vec<TeamMember>,
|
||||
}
|
||||
|
||||
impl Organization {
|
||||
pub fn from(
|
||||
data: crate::database::models::organization_item::Organization,
|
||||
team_members: Vec<TeamMember>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id: data.id.into(),
|
||||
title: data.title,
|
||||
team_id: data.team_id.into(),
|
||||
description: data.description,
|
||||
members: team_members,
|
||||
icon_url: data.icon_url,
|
||||
color: data.color,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user