Update actix-web to 3.0, update deps (#82)

This commit is contained in:
Aeledfyr
2020-10-18 12:50:37 -05:00
committed by GitHub
parent d0fb5c3bd5
commit 25daa9f2da
7 changed files with 425 additions and 280 deletions

660
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,34 +12,31 @@ path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
actix-web = "2.0" actix-web = "3.1.0"
actix-rt = "1.1.1" actix-rt = "1.1.1"
actix-files = "0.2.2" actix-files = "0.4.0"
actix-multipart = "0.2.0" actix-multipart = "0.3.0"
actix-cors = "0.2.0" actix-cors = "0.4.1"
meilisearch-sdk = "0.3.0" meilisearch-sdk = "0.3.0"
reqwest = { version = "0.10.8", features = ["json"] }
reqwest = {version="0.10.6", features=["json"]}
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
rand = "0.7" rand = "0.7.3"
base64 = "0.13.0"
sha1 = { version = "0.6.0", features = ["std"] }
gumdrop = "0.8" gumdrop = "0.8.0"
dotenv = "0.15" dotenv = "0.15"
log = "0.4.8" log = "0.4.8"
env_logger = "0.7.1" env_logger = "0.8.1"
thiserror = "1.0.21"
thiserror = "1.0.20" futures = "0.3.6"
async-trait = "0.1.36"
futures = "0.3.5"
futures-timer = "3.0.2" futures-timer = "3.0.2"
async-trait = "0.1.41"
base64 = "0.12.3"
sha1 = {version="0.6.0", features=["std"]}
[dependencies.sqlx] [dependencies.sqlx]
git = "https://github.com/launchbadge/sqlx/" git = "https://github.com/launchbadge/sqlx/"

View File

@@ -32,7 +32,7 @@ struct Config {
#[actix_rt::main] #[actix_rt::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
dotenv::dotenv().ok(); dotenv::dotenv().ok();
env_logger::from_env(Env::default().default_filter_or("info")).init(); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
let config = Config::parse_args_default_or_exit(); let config = Config::parse_args_default_or_exit();

View File

@@ -78,7 +78,7 @@ pub async fn mod_get(
info: web::Path<(models::ids::ModId,)>, info: web::Path<(models::ids::ModId,)>,
pool: web::Data<PgPool>, pool: web::Data<PgPool>,
) -> Result<HttpResponse, ApiError> { ) -> Result<HttpResponse, ApiError> {
let id = info.0; let id = info.into_inner().0;
let mod_data = database::models::Mod::get_full(id.into(), &**pool) let mod_data = database::models::Mod::get_full(id.into(), &**pool)
.await .await
.map_err(|e| ApiError::DatabaseError(e.into()))?; .map_err(|e| ApiError::DatabaseError(e.into()))?;
@@ -138,7 +138,7 @@ pub async fn mod_delete(
.await .await
.map_err(|_| ApiError::AuthenticationError)?; .map_err(|_| ApiError::AuthenticationError)?;
let id = info.0; let id = info.into_inner().0;
let result = database::models::Mod::remove_full(id.into(), &**pool) let result = database::models::Mod::remove_full(id.into(), &**pool)
.await .await
.map_err(|e| ApiError::DatabaseError(e.into()))?; .map_err(|e| ApiError::DatabaseError(e.into()))?;

View File

@@ -66,7 +66,7 @@ pub async fn user_get(
info: web::Path<(UserId,)>, info: web::Path<(UserId,)>,
pool: web::Data<PgPool>, pool: web::Data<PgPool>,
) -> Result<HttpResponse, ApiError> { ) -> Result<HttpResponse, ApiError> {
let id = info.0; let id = info.into_inner().0;
let user_data = User::get(id.into(), &**pool) let user_data = User::get(id.into(), &**pool)
.await .await
.map_err(|e| ApiError::DatabaseError(e.into()))?; .map_err(|e| ApiError::DatabaseError(e.into()))?;
@@ -94,7 +94,7 @@ pub async fn mods_list(
info: web::Path<(UserId,)>, info: web::Path<(UserId,)>,
pool: web::Data<PgPool>, pool: web::Data<PgPool>,
) -> Result<HttpResponse, ApiError> { ) -> Result<HttpResponse, ApiError> {
let id = info.0.into(); let id = info.into_inner().0.into();
let user_exists = sqlx::query!( let user_exists = sqlx::query!(
"SELECT EXISTS(SELECT 1 FROM users WHERE id = $1)", "SELECT EXISTS(SELECT 1 FROM users WHERE id = $1)",

View File

@@ -351,7 +351,7 @@ pub async fn upload_file_to_version(
let mut transaction = client.begin().await?; let mut transaction = client.begin().await?;
let mut uploaded_files = Vec::new(); let mut uploaded_files = Vec::new();
let version_id = models::VersionId::from(url_data.0); let version_id = models::VersionId::from(url_data.into_inner().0);
let result = upload_file_to_version_inner( let result = upload_file_to_version_inner(
req, req,

View File

@@ -16,7 +16,7 @@ pub async fn version_list(
info: web::Path<(models::ids::ModId,)>, info: web::Path<(models::ids::ModId,)>,
pool: web::Data<PgPool>, pool: web::Data<PgPool>,
) -> Result<HttpResponse, ApiError> { ) -> Result<HttpResponse, ApiError> {
let id = info.0.into(); let id = info.into_inner().0.into();
let mod_exists = sqlx::query!( let mod_exists = sqlx::query!(
"SELECT EXISTS(SELECT 1 FROM mods WHERE id = $1)", "SELECT EXISTS(SELECT 1 FROM mods WHERE id = $1)",
@@ -92,7 +92,7 @@ pub async fn version_get(
info: web::Path<(models::ids::VersionId,)>, info: web::Path<(models::ids::VersionId,)>,
pool: web::Data<PgPool>, pool: web::Data<PgPool>,
) -> Result<HttpResponse, ApiError> { ) -> Result<HttpResponse, ApiError> {
let id = info.0; let id = info.into_inner().0;
let version_data = database::models::Version::get_full(id.into(), &**pool) let version_data = database::models::Version::get_full(id.into(), &**pool)
.await .await
.map_err(|e| ApiError::DatabaseError(e.into()))?; .map_err(|e| ApiError::DatabaseError(e.into()))?;