asklyphe/asklyphe-common/src/nats/authservice/deranklist.rs

28 lines
854 B
Rust
Raw Normal View History

use serde::{Deserialize, Serialize};
use crate::nats::authservice::UserPrivateToken;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DerankEntry {
pub urlmatch: String,
pub and: Option<String>,
pub unless: Option<String>,
pub multiplier: f64,
pub comment: Option<String>,
}
/// # UserFetchActiveDeranksRequest
/// sent from frontend -> authsrvc to receive all applicable derank entries
/// expecting a AuthServiceResponse::UserFetchActiveDeranksResponse back
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserFetchActiveDeranksRequest {
pub token: UserPrivateToken,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum UserFetchActiveDeranksResponse {
Success(Vec<DerankEntry>),
InternalServerError,
/// sent if the token is invalid, and the account should be logged out
Logout,
}