You've already forked AstralRinth
forked from didirus/AstralRinth
Lots of little fixes (#73)
* Lots of little fixes * Change + Add TODOs back that were incomplete * Fix migrations * Run prepare * Minor fixes * Fix formatting * SQLX Prepare
This commit is contained in:
@@ -31,6 +31,10 @@ pub struct Mod {
|
||||
pub body_url: String,
|
||||
/// The date at which the mod was first published.
|
||||
pub published: DateTime<Utc>,
|
||||
/// The date at which the mod was first published.
|
||||
pub updated: DateTime<Utc>,
|
||||
/// The status of the mod
|
||||
pub status: ModStatus,
|
||||
|
||||
/// The total number of downloads the mod has had.
|
||||
pub downloads: u32,
|
||||
@@ -48,6 +52,49 @@ pub struct Mod {
|
||||
pub wiki_url: Option<String>,
|
||||
}
|
||||
|
||||
/// A status decides the visbility of a mod in search, URLs, and the whole site itself.
|
||||
/// Approved - Mod is displayed on search, and accessible by URL
|
||||
/// Rejected - Mod is not displayed on search, and not accessible by URL (Temporary state, mod can reapply)
|
||||
/// Draft - Mod is not displayed on search, and not accessible by URL
|
||||
/// Unlisted - Mod is not displayed on search, but accessible by URL
|
||||
/// Processing - Mod is not displayed on search, and not accessible by URL (Temporary state, mod under review)
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ModStatus {
|
||||
Approved,
|
||||
Rejected,
|
||||
Draft,
|
||||
Unlisted,
|
||||
Processing,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ModStatus {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
ModStatus::Approved => write!(fmt, "release"),
|
||||
ModStatus::Rejected => write!(fmt, "beta"),
|
||||
ModStatus::Draft => write!(fmt, "alpha"),
|
||||
ModStatus::Unlisted => write!(fmt, "unlisted"),
|
||||
ModStatus::Processing => write!(fmt, "Processing"),
|
||||
ModStatus::Unknown => write!(fmt, "Unknown"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ModStatus {
|
||||
pub fn from_str(string: &str) -> ModStatus {
|
||||
match string {
|
||||
"processing" => ModStatus::Processing,
|
||||
"rejected" => ModStatus::Processing,
|
||||
"approved" => ModStatus::Processing,
|
||||
"draft" => ModStatus::Processing,
|
||||
"unlisted" => ModStatus::Processing,
|
||||
_ => ModStatus::Unknown,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A specific version of a mod
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Version {
|
||||
@@ -128,7 +175,7 @@ pub struct SearchRequest {
|
||||
pub query: Option<String>,
|
||||
/// Must match a json 2 deep array of strings `[["categories:misc"]]`
|
||||
// TODO: We may want to have a better representation of this, so that
|
||||
// we are less likely to break backwards compatability
|
||||
// we are less likely to break backwards compatibility
|
||||
pub facets: Option<String>,
|
||||
pub filters: Option<String>,
|
||||
pub version: Option<String>,
|
||||
|
||||
@@ -8,6 +8,8 @@ use serde::{Deserialize, Serialize};
|
||||
#[serde(into = "Base62Id")]
|
||||
pub struct TeamId(pub u64);
|
||||
|
||||
pub const OWNER_ROLE: &str = "Owner";
|
||||
|
||||
// TODO: permissions, role names, etc
|
||||
/// A team of users who control a mod
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user