Skip to content

Commit

Permalink
Use derive feature from serde serde-rs/serde#1441 (comment) (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
rofrol authored and JohnTitor committed Jan 12, 2020
1 parent 5cbaa75 commit 9c34ded
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
3 changes: 1 addition & 2 deletions simple-auth-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ env_logger = "0.6"
futures = "0.3.1"
r2d2 = "0.8"
lazy_static = "1.3.0"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sparkpost = "0.5.2"
uuid = { version = "0.7", features = ["serde", "v4"] }
8 changes: 8 additions & 0 deletions simple-auth-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@
Read the full tutorial series on [gill.net.in](https://gill.net.in)

- [Auth Web Microservice with rust using Actix-Web 1.0 - Complete Tutorial](https://gill.net.in/posts/auth-microservice-rust-actix-web1.0-diesel-complete-tutorial/)

## Dependencies

On Ubuntu 19.10:

```
sudo apt install libclang-dev libpq-dev
```
1 change: 1 addition & 0 deletions simple-auth-server/src/auth_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use actix_web::{
use diesel::prelude::*;
use diesel::PgConnection;
use futures::future::Future;
use serde::Deserialize;

use crate::errors::ServiceError;
use crate::models::{Pool, SlimUser, User};
Expand Down
1 change: 1 addition & 0 deletions simple-auth-server/src/invitation_handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use actix_web::{error::BlockingError, web, HttpResponse};
use diesel::{prelude::*, PgConnection};
use serde::Deserialize;

use crate::email_service::send_invitation;
use crate::errors::ServiceError;
Expand Down
2 changes: 0 additions & 2 deletions simple-auth-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate serde_derive;

use actix_identity::{CookieIdentityPolicy, IdentityService};
use actix_web::{middleware, web, App, HttpServer};
Expand Down
1 change: 1 addition & 0 deletions simple-auth-server/src/models.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::schema::*;
use diesel::{r2d2::ConnectionManager, PgConnection};
use serde::{Deserialize, Serialize};

// type alias to use in multiple places
pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>;
Expand Down
1 change: 1 addition & 0 deletions simple-auth-server/src/register_handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use actix_web::{error::BlockingError, web, HttpResponse};
use diesel::prelude::*;
use serde::Deserialize;

use crate::errors::ServiceError;
use crate::models::{Invitation, Pool, SlimUser, User};
Expand Down

0 comments on commit 9c34ded

Please sign in to comment.