From c3ce0f5b3ad5d58a704bbbe5585f26a071de2301 Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Sat, 17 Feb 2024 02:24:29 +0200 Subject: [PATCH] delete unused stuff --- src/types/mod_json.rs | 1 - src/types/models/mod_entity.rs | 53 +--------------------------------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/src/types/mod_json.rs b/src/types/mod_json.rs index 5bd320f..4d025be 100644 --- a/src/types/mod_json.rs +++ b/src/types/mod_json.rs @@ -3,7 +3,6 @@ use std::io::{Cursor, Read}; use actix_web::web::Bytes; use semver::Version; use serde::Deserialize; -use sqlx::PgConnection; use std::io::BufReader; use zip::read::ZipFile; diff --git a/src/types/models/mod_entity.rs b/src/types/models/mod_entity.rs index 8efcf71..6da3726 100644 --- a/src/types/models/mod_entity.rs +++ b/src/types/models/mod_entity.rs @@ -9,7 +9,7 @@ use crate::{ use actix_web::web::Bytes; use serde::Serialize; use sqlx::{PgConnection, Postgres, QueryBuilder}; -use std::{collections::HashMap, io::Cursor, str::FromStr}; +use std::{io::Cursor, str::FromStr}; use super::{ developer::{Developer, FetchedDeveloper, ModDeveloper}, @@ -292,57 +292,6 @@ impl Mod { Ok(()) } - pub async fn get_all_version_strings_for_mod( - id: &str, - pool: &mut PgConnection, - ) -> Result, ApiError> { - let result = match sqlx::query!( - "SELECT version FROM mod_versions WHERE mod_id = $1 AND validated = true", - id - ) - .fetch_all(&mut *pool) - .await - { - Ok(r) => r, - Err(e) => { - log::error!("{}", e); - return Err(ApiError::DbError); - } - }; - Ok(result.iter().map(|x| x.version.clone()).collect()) - } - - pub async fn get_all_version_strings_for_mods( - ids: Vec, - pool: &mut PgConnection, - ) -> Result>, ApiError> { - let mut ret: HashMap> = HashMap::new(); - if ids.is_empty() { - return Ok(ret); - } - let result = match sqlx::query!( - "SELECT version, mod_id FROM mod_versions WHERE mod_id = ANY($1) AND validated = true", - &ids - ) - .fetch_all(&mut *pool) - .await - { - Ok(r) => r, - Err(e) => { - log::error!("{}", e); - return Err(ApiError::DbError); - } - }; - for i in result { - if ret.contains_key(&i.mod_id) { - ret.get_mut(&i.mod_id).unwrap().push(i.version); - } else { - ret.insert(i.mod_id.clone(), vec![i.version]); - } - } - Ok(ret) - } - pub async fn new_version( json: &ModJson, developer: FetchedDeveloper,