Clippy
This commit is contained in:
parent
d3ec3ed422
commit
546e883a9c
3 changed files with 8 additions and 8 deletions
|
@ -90,7 +90,7 @@ pub struct LocationEntry {
|
||||||
|
|
||||||
impl LocationEntry {
|
impl LocationEntry {
|
||||||
pub fn location_coordinates(&self) -> Option<LocationCoordinates> {
|
pub fn location_coordinates(&self) -> Option<LocationCoordinates> {
|
||||||
self.location_coordinates.as_ref().map(|v| serde_json::from_str(&v).unwrap())
|
self.location_coordinates.as_ref().map(|v| serde_json::from_str(v).unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use axum::{async_trait, extract::FromRequestParts, http::{header::AUTHORIZATION, request::Parts, StatusCode}};
|
use axum::{async_trait, extract::FromRequestParts, http::{header::AUTHORIZATION, request::Parts, StatusCode}};
|
||||||
use jsonwebtoken::Validation;
|
use jsonwebtoken::Validation;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use tracing::{warn, info};
|
use tracing::warn;
|
||||||
|
|
||||||
use crate::env;
|
use crate::env;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ where
|
||||||
{
|
{
|
||||||
type Rejection = (StatusCode, &'static str);
|
type Rejection = (StatusCode, &'static str);
|
||||||
|
|
||||||
async fn from_request_parts(parts: &mut Parts, state: &S) -> Result<Self, Self::Rejection> {
|
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
|
||||||
if let Some(authorization) = parts.headers.get(AUTHORIZATION) {
|
if let Some(authorization) = parts.headers.get(AUTHORIZATION) {
|
||||||
if let Ok(authorization) = authorization.to_str() {
|
if let Ok(authorization) = authorization.to_str() {
|
||||||
let token = authorization.replacen("Bearer ", "", 1);
|
let token = authorization.replacen("Bearer ", "", 1);
|
||||||
|
|
|
@ -8,14 +8,14 @@ use jsonwebtoken::Header;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use crate::{database::models::User, database::list::List, env, http::extractors::auth::{ExtractUser, JwtUser}, AppState};
|
use crate::{database::models::User, env, http::extractors::auth::{ExtractUser, JwtUser}, AppState};
|
||||||
|
|
||||||
pub fn auth_router() -> Router<AppState> {
|
pub fn auth_router() -> Router<AppState> {
|
||||||
let router = Router::new()
|
|
||||||
.route("/auth/account", get(account))
|
|
||||||
.route("/auth/register", post(register));
|
|
||||||
|
|
||||||
router
|
Router::new()
|
||||||
|
.route("/auth/account", get(account))
|
||||||
|
.route("/auth/register", post(register))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn account(ExtractUser(jwt_user): ExtractUser, State(state): State<AppState>) -> Result<Json<User>, StatusCode> {
|
async fn account(ExtractUser(jwt_user): ExtractUser, State(state): State<AppState>) -> Result<Json<User>, StatusCode> {
|
||||||
|
|
Loading…
Reference in a new issue