mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-24 17:11:49 +00:00
refactor: session auth public only in crate
This commit is contained in:
parent
05369b977a
commit
3b9bf7cdda
2 changed files with 3 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use entity::candidate::Model as Candidate;
|
use entity::candidate::Model as Candidate;
|
||||||
use portfolio_core::sea_orm::prelude::Uuid;
|
use portfolio_core::sea_orm::prelude::Uuid;
|
||||||
use portfolio_core::services::session_service::SessionService;
|
use portfolio_core::services::candidate_service::CandidateService;
|
||||||
use rocket::http::Status;
|
use rocket::http::Status;
|
||||||
use rocket::outcome::Outcome;
|
use rocket::outcome::Outcome;
|
||||||
use rocket::request::{FromRequest, Request};
|
use rocket::request::{FromRequest, Request};
|
||||||
|
|
@ -27,7 +27,7 @@ impl<'r> FromRequest<'r> for SessionAuth {
|
||||||
Err(_) => return Outcome::Failure((Status::BadRequest, None)),
|
Err(_) => return Outcome::Failure((Status::BadRequest, None)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let session = SessionService::auth_user_session(conn, uuid).await;
|
let session = CandidateService::auth(conn, uuid).await;
|
||||||
|
|
||||||
match session {
|
match session {
|
||||||
Ok(model) => Outcome::Success(SessionAuth(model)),
|
Ok(model) => Outcome::Success(SessionAuth(model)),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use sea_orm::{DatabaseConnection, prelude::Uuid, ModelTrait};
|
||||||
use crate::{crypto::{self}, Query, error::{ServiceError}, Mutation};
|
use crate::{crypto::{self}, Query, error::{ServiceError}, Mutation};
|
||||||
|
|
||||||
// TODO: generics
|
// TODO: generics
|
||||||
pub struct SessionService;
|
pub(crate) struct SessionService;
|
||||||
|
|
||||||
impl SessionService {
|
impl SessionService {
|
||||||
/// Delete n old sessions for user
|
/// Delete n old sessions for user
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue