docs: Improve schemas docs
All checks were successful
Write changelog / write-changelog (push) Successful in 3s
Update Contributors / Update Contributors (push) Successful in 4s
Rust CI / Rust CI (push) Successful in 4m34s

Fixes: #32
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-07-27 05:27:06 +03:00
parent bf1d322fe2
commit b4cac39157
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F
2 changed files with 3 additions and 9 deletions

View file

@ -33,15 +33,7 @@ mod user;
pub use user::*; pub use user::*;
/// Json message schema, used for returning messages to the client, the message /// Message schema, used for returning messages.
/// must be human readable.
///
/// # Example
/// ```json
/// {
/// "message": "Message"
/// }
/// ```
#[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)] #[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)]
#[salvo(schema(name = MessageSchema, example = json!(MessageSchema::new("Message".to_owned()))))] #[salvo(schema(name = MessageSchema, example = json!(MessageSchema::new("Message".to_owned()))))]
pub struct MessageSchema { pub struct MessageSchema {

View file

@ -24,6 +24,7 @@ use oxidetalis_entities::prelude::*;
use salvo::oapi::ToSchema; use salvo::oapi::ToSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// WhiteListed user schema, represents a whitelisted user.
#[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)] #[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)]
#[salvo(schema(name = WhiteListedUser, example = json!(WhiteListedUser::default())))] #[salvo(schema(name = WhiteListedUser, example = json!(WhiteListedUser::default())))]
pub struct WhiteListedUser { pub struct WhiteListedUser {
@ -33,6 +34,7 @@ pub struct WhiteListedUser {
pub whitelisted_at: DateTime<Utc>, pub whitelisted_at: DateTime<Utc>,
} }
/// Blacklisted user schema, represents a blacklisted user.
#[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)] #[derive(Serialize, Deserialize, Clone, Debug, ToSchema, derive_new::new)]
#[salvo(schema(name = BlackListedUser, example = json!(BlackListedUser::default())))] #[salvo(schema(name = BlackListedUser, example = json!(BlackListedUser::default())))]
pub struct BlackListedUser { pub struct BlackListedUser {