Refactor tags services and added tests
Implemented some functionality which will allow the service configuration of the app to be split among the features for readability and testability.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use std::sync::Mutex;
|
||||
use actix_web::Responder;
|
||||
use actix_web::{
|
||||
web::{self, Json},
|
||||
@@ -7,6 +6,7 @@ use actix_web::{
|
||||
use chrono::{Duration, Utc};
|
||||
use jsonwebtoken::{encode, EncodingKey, Header};
|
||||
use log::{debug, error};
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
data::{secret_key, Claims, CreateAccountRequest, LoginRequest, Token},
|
||||
@@ -32,7 +32,10 @@ async fn register<D: UserDao>(
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn login<D: UserDao>(creds: Json<LoginRequest>, user_dao: web::Data<Mutex<D>>) -> HttpResponse {
|
||||
pub async fn login<D: UserDao>(
|
||||
creds: Json<LoginRequest>,
|
||||
user_dao: web::Data<Mutex<D>>,
|
||||
) -> HttpResponse {
|
||||
debug!("Logging in: {}", creds.username);
|
||||
|
||||
let mut user_dao = user_dao.lock().expect("Unable to get UserDao");
|
||||
|
||||
Reference in New Issue
Block a user