use session::Session;

use crate::{AppService, error::AppError};

impl AppService {
    pub async fn auth_logout(&self, context: &Session) -> Result<(), AppError> {
        if let Some(user_uid) = context.user() {
            tracing::info!(user_uid = %user_uid, ip = ?context.ip_address(), "User logged out");
        }
        context.clear_user();
        context.clear();
        Ok(())
    }
}
