format
This commit is contained in:
parent
d57fd670b3
commit
6b07772a18
@ -1,7 +1,7 @@
|
||||
use crate::{auth::Backend, models::rating::Rating, page, AppState};
|
||||
use axum::{extract::State, routing::get, Router};
|
||||
use crate::{AppState, auth::Backend, models::rating::Rating, page};
|
||||
use axum::{Router, extract::State, routing::get};
|
||||
use axum_login::login_required;
|
||||
use maud::{html, Markup};
|
||||
use maud::{Markup, html};
|
||||
use rand::{
|
||||
distr::{Distribution, Uniform},
|
||||
rng,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
admin::{station::Station, team::Team},
|
||||
AppState,
|
||||
admin::{station::Station, team::Team},
|
||||
};
|
||||
use axum::Router;
|
||||
use futures::future::join_all;
|
||||
|
@ -1,12 +1,12 @@
|
||||
use super::Route;
|
||||
use crate::{admin::station::Station, er, page, suc, AppState};
|
||||
use crate::{AppState, admin::station::Station, er, page, suc};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
use maud::{Markup, PreEscaped, html};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::sync::Arc;
|
||||
|
@ -1,13 +1,13 @@
|
||||
use super::{generate_random_alphanumeric, team::Team};
|
||||
use crate::{
|
||||
AppState,
|
||||
admin::route::Route,
|
||||
models::rating::{Rating, TeamsAtStationLocation},
|
||||
AppState,
|
||||
};
|
||||
use axum::Router;
|
||||
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
||||
use futures::{stream, StreamExt};
|
||||
use maud::{html, Markup, Render};
|
||||
use futures::{StreamExt, stream};
|
||||
use maud::{Markup, Render, html};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
use crate::{
|
||||
AppState,
|
||||
admin::{station::Station, team::Team},
|
||||
er, err,
|
||||
models::rating::{Rating, TeamsAtStationLocation},
|
||||
partials::page,
|
||||
suc, succ, AppState,
|
||||
suc, succ,
|
||||
};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use maud::{html, Markup};
|
||||
use maud::{Markup, html};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
AppState,
|
||||
admin::{route::Route, station::Station},
|
||||
models::rating::Rating,
|
||||
AppState,
|
||||
};
|
||||
use axum::Router;
|
||||
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
||||
|
@ -1,18 +1,19 @@
|
||||
use super::{CreateError, LastContactTeam, Team};
|
||||
use crate::{
|
||||
AppState,
|
||||
admin::{route::Route, station::Station},
|
||||
err,
|
||||
models::rating::Rating,
|
||||
partials::page,
|
||||
pl, succ, AppState,
|
||||
pl, succ,
|
||||
};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
use maud::{Markup, PreEscaped, html};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
@ -47,20 +48,20 @@ async fn create(
|
||||
}
|
||||
Err(CreateError::DuplicateName(e)) => {
|
||||
err!(
|
||||
session,
|
||||
"Team '{}' konnte _NICHT_ erstellt werden, da es bereits ein Team mit diesem Namen gibt ({e})!",
|
||||
form.name
|
||||
);
|
||||
session,
|
||||
"Team '{}' konnte _NICHT_ erstellt werden, da es bereits ein Team mit diesem Namen gibt ({e})!",
|
||||
form.name
|
||||
);
|
||||
|
||||
return Redirect::to("/admin/team");
|
||||
}
|
||||
Err(CreateError::NoStationForRoute) => {
|
||||
err!(
|
||||
session,
|
||||
"Team '{}' konnte _NICHT_ erstellt werden, da in der angegebenen Route '{}' noch keine Stationen vorkommen",
|
||||
form.name,
|
||||
route.name
|
||||
);
|
||||
session,
|
||||
"Team '{}' konnte _NICHT_ erstellt werden, da in der angegebenen Route '{}' noch keine Stationen vorkommen",
|
||||
form.name,
|
||||
route.name
|
||||
);
|
||||
|
||||
return Redirect::to("/admin/team");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::generate_random_alphanumeric;
|
||||
use crate::{auth::User, AppState};
|
||||
use crate::{AppState, auth::User};
|
||||
use argon2::password_hash::rand_core::OsRng;
|
||||
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
|
||||
use argon2::{Argon2, PasswordHasher, password_hash::SaltString};
|
||||
use axum::Router;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::{auth::User, err, partials::page, succ, AppState};
|
||||
use crate::{AppState, auth::User, err, partials::page, succ};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use maud::{html, Markup};
|
||||
use maud::{Markup, html};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::sync::Arc;
|
||||
|
@ -1,13 +1,13 @@
|
||||
use crate::{er, page, suc, AppState};
|
||||
use crate::{AppState, er, page, suc};
|
||||
use async_trait::async_trait;
|
||||
use axum::{
|
||||
Form, Router,
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use axum_login::{AuthUser, AuthnBackend};
|
||||
use maud::{html, Markup};
|
||||
use maud::{Markup, html};
|
||||
use password_auth::verify_password;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
|
@ -19,20 +19,20 @@ i18n!("locales", fallback = "de-AT");
|
||||
use admin::station::Station;
|
||||
use auth::{AuthSession, Backend, User};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
body::Body,
|
||||
extract::{FromRef, State},
|
||||
response::{IntoResponse, Redirect, Response},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use axum_login::AuthManagerLayerBuilder;
|
||||
use maud::{html, Markup};
|
||||
use maud::{Markup, html};
|
||||
use partials::page;
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::{env, sync::Arc};
|
||||
use tokio::net::TcpListener;
|
||||
use tower_sessions::{cookie::time::Duration, Expiry, Session, SessionManagerLayer};
|
||||
use tower_sessions::{Expiry, Session, SessionManagerLayer, cookie::time::Duration};
|
||||
use tower_sessions_sqlx_store_chrono::SqliteStore;
|
||||
|
||||
pub(crate) mod admin;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use dotenv::dotenv;
|
||||
use sqlx::{pool::PoolOptions, SqlitePool};
|
||||
use sqlx::{SqlitePool, pool::PoolOptions};
|
||||
use std::env;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{admin::team::Team, Station};
|
||||
use crate::{Station, admin::team::Team};
|
||||
use chrono::{DateTime, Local, NaiveDateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{FromRow, SqlitePool};
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::test_version;
|
||||
use maud::{html, Markup, DOCTYPE};
|
||||
use maud::{DOCTYPE, Markup, html};
|
||||
use tower_sessions::Session;
|
||||
|
||||
pub(crate) async fn page(content: Markup, session: Session, leaflet: bool) -> Markup {
|
||||
|
@ -1,14 +1,14 @@
|
||||
use crate::{
|
||||
admin::team::Team, err, models::rating::TeamsAtStationLocation, partials, succ, AppState,
|
||||
Station,
|
||||
AppState, Station, admin::team::Team, err, models::rating::TeamsAtStationLocation, partials,
|
||||
succ,
|
||||
};
|
||||
use axum::{
|
||||
Form, Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Redirect},
|
||||
routing::{get, post},
|
||||
Form, Router,
|
||||
};
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
use maud::{Markup, PreEscaped, html};
|
||||
use serde::Deserialize;
|
||||
use sqlx::SqlitePool;
|
||||
use std::sync::Arc;
|
||||
@ -571,7 +571,7 @@ pub(super) fn routes() -> Router<AppState> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{router, testdb, Station};
|
||||
use crate::{Station, router, testdb};
|
||||
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user