All checks were successful
Rust Build / Test Suite (push) Successful in 29s
Rust Build / Clippy (push) Successful in 30s
Rust Build / Clippy (pull_request) Successful in 29s
Rust Build / build (pull_request) Successful in 35s
Release Tagging / release (push) Successful in 34s
Rust Build / Check (push) Successful in 28s
Rust Build / Rustfmt (push) Successful in 34s
Rust Build / build (push) Successful in 28s
Rust Build / Check (pull_request) Successful in 32s
Rust Build / Test Suite (pull_request) Successful in 31s
Rust Build / Rustfmt (pull_request) Successful in 27s
Reviewed-on: #36 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
32 lines
712 B
Rust
32 lines
712 B
Rust
use std::default::Default;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct LoginResult {
|
|
pub id: uuid::Uuid,
|
|
pub username: String,
|
|
pub token: String,
|
|
#[serde(alias = "token_type")]
|
|
pub token_type: String,
|
|
pub expiration: i64,
|
|
}
|
|
|
|
impl Default for LoginResult {
|
|
fn default() -> Self {
|
|
LoginResult {
|
|
id: uuid::Uuid::nil(),
|
|
username: String::new(),
|
|
token: String::new(),
|
|
token_type: String::new(),
|
|
expiration: -1,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl LoginResult {
|
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
|
serde_json::to_string_pretty(&self)
|
|
}
|
|
}
|