pub async fn create_session(pool: &DBPool, user_id: i32) -> Result<Session> {
        let mut res = generic_service_err!(
            sqlx::query_file_as!(Session, "sql/session/create_session.sql", user_id)
            .fetch_all(pool).await,
            "Failed to create new session");

        delete_old_user_sessions(pool, user_id).await?;

        Ok(res.remove(0))
    }
/// Creates a user session and returns the resulting record
/// 
/// # Arguments
/// 
/// * `pool` - The database pool
/// * `user_id` - The ID of the user creating the session
Creates a user session and returns the resulting record
Creates a user session and returns the resulting record
pub async fn create_session(pool: &DBPool, user_id: i32) -> Result<Session> {
        let mut res = generic_service_err!(
            sqlx::query_file_as!(Session, "sql/session/create_session.sql", user_id)
            .fetch_all(pool).await,
            "Failed to create new session");
        delete_old_user_sessions(pool, user_id).await?;
        Ok(res.remove(0))
    }
pub async fn create_session ( pool : & DBPool , user_id : i32 ) -> Result < Session > { let mut res = generic_service_err ! ( sqlx query_file_as ( Session " " user_id ) fetch_all ( pool ) await " " ) ; delete_old_user_sessions ( pool , user_id ) . await ? ; Ok ( res . remove ( 0 ) ) }
Creates a user session and returns the resulting record
Creates a user session and returns the resulting record
pool
&DBPool
user_id
i32
pool
&DBPool
user_id
i32