diff --git a/auth/simple-auth-server/src/register_handler.rs b/auth/simple-auth-server/src/register_handler.rs index 071f852..d92df16 100644 --- a/auth/simple-auth-server/src/register_handler.rs +++ b/auth/simple-auth-server/src/register_handler.rs @@ -5,6 +5,7 @@ use serde::Deserialize; use crate::errors::ServiceError; use crate::models::{Invitation, Pool, SlimUser, User}; use crate::utils::hash_password; + // UserData is used to extract data from a post request by the client #[derive(Debug, Deserialize)] pub struct UserData { diff --git a/databases/diesel/src/main.rs b/databases/diesel/src/main.rs index 39655ab..5d8c6ee 100644 --- a/databases/diesel/src/main.rs +++ b/databases/diesel/src/main.rs @@ -103,7 +103,7 @@ mod tests { .build(manager) .expect("Failed to create pool."); - let mut app = test::init_service( + let app = test::init_service( App::new() .app_data(web::Data::new(pool.clone())) .wrap(middleware::Logger::default()) @@ -120,7 +120,7 @@ mod tests { }) .to_request(); - let resp: models::User = test::call_and_read_body_json(&mut app, req).await; + let resp: models::User = test::call_and_read_body_json(&app, req).await; assert_eq!(resp.name, "Test user"); @@ -129,7 +129,7 @@ mod tests { .uri(&format!("/user/{}", resp.id)) .to_request(); - let resp: models::User = test::call_and_read_body_json(&mut app, req).await; + let resp: models::User = test::call_and_read_body_json(&app, req).await; assert_eq!(resp.name, "Test user"); diff --git a/forms/multipart-s3/src/main.rs b/forms/multipart-s3/src/main.rs index be6982b..0d32702 100644 --- a/forms/multipart-s3/src/main.rs +++ b/forms/multipart-s3/src/main.rs @@ -33,9 +33,8 @@ async fn index() -> HttpResponse { Upload Test
- - - + +
@@ -45,7 +44,7 @@ async fn index() -> HttpResponse { function myFunction(){ var myForm = document.getElementById('myForm'); var myFile = document.getElementById('myFile'); - + let formData = new FormData(); const obj = { text: document.getElementById('text').value, @@ -54,17 +53,15 @@ async fn index() -> HttpResponse { const json = JSON.stringify(obj); console.log(obj); console.log(json); - - + formData.append("data", json); formData.append("myFile", myFile.files[0]); - + var request = new XMLHttpRequest(); request.open("POST", ""); request.send(formData); } - - + "#; diff --git a/graphql/juniper-advanced/src/main.rs b/graphql/juniper-advanced/src/main.rs index ec12e5f..af99bec 100644 --- a/graphql/juniper-advanced/src/main.rs +++ b/graphql/juniper-advanced/src/main.rs @@ -1,6 +1,3 @@ -#[macro_use] -extern crate juniper; - use actix_cors::Cors; use actix_web::{middleware::Logger, web::Data, App, HttpServer}; diff --git a/graphql/juniper-advanced/src/schemas/product.rs b/graphql/juniper-advanced/src/schemas/product.rs index 47a79aa..b1dd314 100644 --- a/graphql/juniper-advanced/src/schemas/product.rs +++ b/graphql/juniper-advanced/src/schemas/product.rs @@ -1,3 +1,4 @@ +use juniper::GraphQLInputObject; use mysql::{from_row, params, Error as DBError, Row}; use crate::schemas::root::Context; diff --git a/graphql/juniper-advanced/src/schemas/root.rs b/graphql/juniper-advanced/src/schemas/root.rs index 8302fb2..420e956 100644 --- a/graphql/juniper-advanced/src/schemas/root.rs +++ b/graphql/juniper-advanced/src/schemas/root.rs @@ -1,4 +1,6 @@ -use juniper::{EmptySubscription, FieldError, FieldResult, RootNode}; +use juniper::{ + graphql_object, graphql_value, EmptySubscription, FieldError, FieldResult, RootNode, +}; use mysql::{from_row, params, Error as DBError, Row}; use crate::db::Pool; @@ -14,7 +16,7 @@ impl juniper::Context for Context {} pub struct QueryRoot; -#[juniper::graphql_object(Context = Context)] +#[graphql_object(Context = Context)] impl QueryRoot { #[graphql(description = "List of all users")] fn users(context: &Context) -> FieldResult> { @@ -99,7 +101,7 @@ impl QueryRoot { pub struct MutationRoot; -#[juniper::graphql_object(Context = Context)] +#[graphql_object(Context = Context)] impl MutationRoot { fn create_user(context: &Context, user: UserInput) -> FieldResult { let mut conn = context.dbpool.get().unwrap(); diff --git a/graphql/juniper-advanced/src/schemas/user.rs b/graphql/juniper-advanced/src/schemas/user.rs index 0776c0a..64cca1c 100644 --- a/graphql/juniper-advanced/src/schemas/user.rs +++ b/graphql/juniper-advanced/src/schemas/user.rs @@ -1,3 +1,4 @@ +use juniper::{graphql_object, GraphQLInputObject}; use mysql::{from_row, params}; use crate::schemas::product::Product; @@ -18,7 +19,7 @@ pub struct UserInput { pub email: String, } -#[juniper::graphql_object(Context = Context)] +#[graphql_object(Context = Context)] impl User { fn id(&self) -> &str { &self.id diff --git a/protobuf/src/main.rs b/protobuf/src/main.rs index 27bcf1b..bb189f0 100644 --- a/protobuf/src/main.rs +++ b/protobuf/src/main.rs @@ -1,8 +1,6 @@ -#[macro_use] -extern crate prost_derive; - use actix_protobuf::{ProtoBuf, ProtoBufResponseBuilder as _}; use actix_web::{middleware, web, App, HttpResponse, HttpServer, Result}; +use prost_derive::Message; #[derive(Clone, PartialEq, Message)] pub struct MyObj {