asklyphe/asklyphe-common/src/nats/authservice/deranklist.rs
husky 08903aa0a1
All checks were successful
/ build-all-services (push) Successful in 9m57s
initial nats routes for deranking + authservice
currently only routes for fetching deranks, they'll have to be manually
inserted into the database at the moment until we add further routes
2025-03-18 16:55:58 -07:00

27 lines
854 B
Rust

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,
}