Mod Creation (#34)

* Inital creation stuff

* File Reader

* Upload bodies

* Major rework:

* Finish Multiple Files

* Proper Error Handling

* Switch to database models

* Run formatter

* Make dependencies dependent on Versions over mods

* Fixes

* Fix clippy

* Run lint one last time

* Update src/models/mods.rs

Co-authored-by: AppleTheGolden <scotsbox@protonmail.com>

Co-authored-by: AppleTheGolden <scotsbox@protonmail.com>
This commit is contained in:
Geometrically
2020-07-16 10:16:35 -07:00
committed by GitHub
parent b1d3e258bd
commit 39b1435725
17 changed files with 567 additions and 27 deletions

View File

@@ -3,19 +3,39 @@ use crate::database::Result;
use bson::{Bson, Document};
use serde::{Deserialize, Serialize};
//TODO: Files should probably be moved to their own table
#[derive(Deserialize, Serialize)]
pub struct Version {
///The unqiue VersionId of this version
pub version_id: i32,
/// The ModId of the mod that this version belongs to
pub mod_id: i32,
pub title: String,
pub changelog_path: String,
pub files_path: Vec<String>,
pub name: String,
pub number: String,
pub changelog_url: Option<String>,
pub date_published: String,
pub author: String,
pub downloads: i32,
pub dependencies: Vec<String>,
pub files: Vec<VersionFile>,
pub dependencies: Vec<i32>,
pub game_versions: Vec<String>,
pub loaders: Vec<String>,
pub version_type: String,
}
#[derive(Serialize, Deserialize)]
pub struct VersionFile {
pub game_versions: Vec<String>,
pub hashes: Vec<FileHash>,
pub url: String,
}
/// A hash of a mod's file
#[derive(Serialize, Deserialize)]
pub struct FileHash {
pub algorithm: String,
pub hash: String,
}
impl Item for Version {
fn get_collection() -> &'static str {
"versions"