mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
group imports
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
use casbin::{CoreApi, DefaultModel, Enforcer, FileAdapter, RbacApi};
|
||||
use std::io;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use actix_web::{middleware, web, App, HttpRequest, HttpResponse, HttpServer};
|
||||
use casbin::{CoreApi, DefaultModel, Enforcer, FileAdapter, RbacApi};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
/// simple handle
|
||||
async fn success(enforcer: web::Data<RwLock<Enforcer>>, req: HttpRequest) -> HttpResponse {
|
||||
|
@ -100,7 +100,6 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use actix_web::{
|
||||
middleware,
|
||||
web::{get, post, resource},
|
||||
@ -108,6 +107,8 @@ mod test {
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[actix_web::test]
|
||||
async fn test_workflow() {
|
||||
let private_key = actix_web::cookie::Key::generate();
|
||||
|
@ -1,10 +1,9 @@
|
||||
// email_service.rs
|
||||
use crate::errors::ServiceError;
|
||||
use crate::models::Invitation;
|
||||
use sparkpost::transmission::{
|
||||
EmailAddress, Message, Options, Recipient, Transmission, TransmissionResponse,
|
||||
};
|
||||
|
||||
use crate::{errors::ServiceError, models::Invitation};
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref API_KEY: String = std::env::var("SPARKPOST_API_KEY").expect("SPARKPOST_API_KEY must be set");
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use std::convert::From;
|
||||
|
||||
use actix_web::{error::ResponseError, HttpResponse};
|
||||
use derive_more::Display;
|
||||
use diesel::result::{DatabaseErrorKind, Error as DBError};
|
||||
use std::convert::From;
|
||||
use uuid::Error as ParseError;
|
||||
|
||||
#[derive(Debug, Display)]
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::schema::*;
|
||||
use diesel::{r2d2::ConnectionManager, PgConnection};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::schema::*;
|
||||
|
||||
// type alias to use in multiple places
|
||||
pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::errors::ServiceError;
|
||||
use argon2::{self, Config};
|
||||
|
||||
use crate::errors::ServiceError;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref SECRET_KEY: String = std::env::var("SECRET_KEY").unwrap_or_else(|_| "0123".repeat(8));
|
||||
}
|
||||
|
Reference in New Issue
Block a user