You've already forked AstralRinth
forked from didirus/AstralRinth
Implement users in API
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
use thiserror::Error;
|
||||
|
||||
pub use super::mods::{ModId, VersionId};
|
||||
pub use super::teams::{TeamId, UserId};
|
||||
pub use super::teams::TeamId;
|
||||
pub use super::users::UserId;
|
||||
|
||||
/// Generates a random 64 bit integer that is exactly `n` characters
|
||||
/// long when encoded as base62.
|
||||
|
||||
@@ -2,3 +2,4 @@ pub mod error;
|
||||
pub mod ids;
|
||||
pub mod mods;
|
||||
pub mod teams;
|
||||
pub mod users;
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
use super::ids::Base62Id;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::models::users::UserId;
|
||||
|
||||
//TODO Implement Item for teams
|
||||
/// The ID of a specific user, encoded as base62 for usage in the API
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
#[serde(into = "Base62Id")]
|
||||
pub struct UserId(pub u64);
|
||||
|
||||
/// The ID of a team
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
|
||||
19
src/models/users.rs
Normal file
19
src/models/users.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use super::ids::Base62Id;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
#[serde(into = "Base62Id")]
|
||||
pub struct UserId(pub u64);
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct User {
|
||||
pub id: UserId,
|
||||
pub github_id: UserId,
|
||||
pub username: String,
|
||||
pub name: String,
|
||||
pub email: Option<String>,
|
||||
pub avatar_url: String,
|
||||
pub bio: String,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
}
|
||||
Reference in New Issue
Block a user