From 3e4141f30ef167baf3d91069c23b9c85fac73943 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Mon, 22 Jul 2024 10:15:50 +0300
Subject: [PATCH] docs: Add detailed descriptions to files header
Signed-off-by: Awiteb
---
crates/oxidetalis/src/database/mod.rs | 2 +-
crates/oxidetalis/src/database/user_status.rs | 4 ++--
crates/oxidetalis/src/errors.rs | 2 ++
crates/oxidetalis/src/extensions.rs | 2 ++
crates/oxidetalis/src/routes/errors.rs | 2 ++
crates/oxidetalis/src/routes/mod.rs | 2 ++
crates/oxidetalis/src/schemas/mod.rs | 2 ++
crates/oxidetalis/src/schemas/user.rs | 2 ++
crates/oxidetalis/src/utils.rs | 2 ++
crates/oxidetalis/src/websocket/mod.rs | 3 +++
crates/oxidetalis_core/src/types/cipher.rs | 2 ++
crates/oxidetalis_core/src/types/impl_serde.rs | 2 ++
crates/oxidetalis_entities/src/incoming_chat_requests.rs | 4 +++-
crates/oxidetalis_entities/src/lib.rs | 4 +++-
crates/oxidetalis_entities/src/outgoing_chat_requests.rs | 4 +++-
crates/oxidetalis_entities/src/prelude.rs | 4 +++-
crates/oxidetalis_entities/src/users.rs | 4 +++-
crates/oxidetalis_entities/src/users_status.rs | 4 +++-
.../src/create_incoming_chat_requests_table.rs | 5 ++++-
.../src/create_outgoing_chat_requests_table.rs | 5 ++++-
crates/oxidetalis_migrations/src/create_users_status.rs | 5 ++++-
crates/oxidetalis_migrations/src/create_users_table.rs | 4 +++-
crates/oxidetalis_migrations/src/lib.rs | 4 +++-
23 files changed, 60 insertions(+), 14 deletions(-)
diff --git a/crates/oxidetalis/src/database/mod.rs b/crates/oxidetalis/src/database/mod.rs
index ada1149..8d51890 100644
--- a/crates/oxidetalis/src/database/mod.rs
+++ b/crates/oxidetalis/src/database/mod.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-//! Database utilities for the OxideTalis homeserver.
+//! Database trait extensions.
mod in_chat_requests;
mod out_chat_requests;
diff --git a/crates/oxidetalis/src/database/user_status.rs b/crates/oxidetalis/src/database/user_status.rs
index 8fe9e27..4daf506 100644
--- a/crates/oxidetalis/src/database/user_status.rs
+++ b/crates/oxidetalis/src/database/user_status.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-//! Database extension to work with the whitelist table
+//! Database extension for the `users_status` table
use std::num::{NonZeroU32, NonZeroU8};
@@ -25,7 +25,7 @@ use sea_orm::DatabaseConnection;
use crate::{errors::ServerResult, websocket::errors::WsError};
-/// Extension trait for the `DatabaseConnection` to work with the whitelist
+/// Extension trait for the `DatabaseConnection` to work with the users status
/// table
pub trait UsersStatusExt {
/// Returns true if the `whitelister` has whitelisted the
diff --git a/crates/oxidetalis/src/errors.rs b/crates/oxidetalis/src/errors.rs
index 50ef6d1..c576f5e 100644
--- a/crates/oxidetalis/src/errors.rs
+++ b/crates/oxidetalis/src/errors.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis errors types, internal, api and websocket errors.
+
use sea_orm::DbErr;
use crate::{routes::ApiError, websocket::errors::WsError};
diff --git a/crates/oxidetalis/src/extensions.rs b/crates/oxidetalis/src/extensions.rs
index 04eb4b6..e071acc 100644
--- a/crates/oxidetalis/src/extensions.rs
+++ b/crates/oxidetalis/src/extensions.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Global trait extensions for the Oxidetalis server.
+
use std::sync::Arc;
use chrono::Utc;
diff --git a/crates/oxidetalis/src/routes/errors.rs b/crates/oxidetalis/src/routes/errors.rs
index 644e968..1707c3e 100644
--- a/crates/oxidetalis/src/routes/errors.rs
+++ b/crates/oxidetalis/src/routes/errors.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis API errors.
+
use salvo::{
http::StatusCode,
oapi::{Components as OapiComponents, EndpointOutRegister, Operation as OapiOperation},
diff --git a/crates/oxidetalis/src/routes/mod.rs b/crates/oxidetalis/src/routes/mod.rs
index f63b864..f23e563 100644
--- a/crates/oxidetalis/src/routes/mod.rs
+++ b/crates/oxidetalis/src/routes/mod.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis server routes, all the routes of the server.
+
use std::env;
use std::sync::Arc;
diff --git a/crates/oxidetalis/src/schemas/mod.rs b/crates/oxidetalis/src/schemas/mod.rs
index 59eff43..041c2d9 100644
--- a/crates/oxidetalis/src/schemas/mod.rs
+++ b/crates/oxidetalis/src/schemas/mod.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis api schemas.
+
use salvo::{
http::{header, StatusCode},
oapi::{
diff --git a/crates/oxidetalis/src/schemas/user.rs b/crates/oxidetalis/src/schemas/user.rs
index e3ffa92..feec7f2 100644
--- a/crates/oxidetalis/src/schemas/user.rs
+++ b/crates/oxidetalis/src/schemas/user.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! User API schemas
+
use std::str::FromStr;
use chrono::{DateTime, Utc};
diff --git a/crates/oxidetalis/src/utils.rs b/crates/oxidetalis/src/utils.rs
index e65162f..d4b38b6 100644
--- a/crates/oxidetalis/src/utils.rs
+++ b/crates/oxidetalis/src/utils.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis server utilities, utilities shared across the crate.
+
use std::str::FromStr;
use chrono::Utc;
diff --git a/crates/oxidetalis/src/websocket/mod.rs b/crates/oxidetalis/src/websocket/mod.rs
index 2b1111c..dcbdd56 100644
--- a/crates/oxidetalis/src/websocket/mod.rs
+++ b/crates/oxidetalis/src/websocket/mod.rs
@@ -14,6 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+//! Oxidetalis WebSocket server implementation, handling the WebSocket
+//! connections.
+
use std::{collections::HashMap, sync::Arc, time::Duration};
use chrono::Utc;
diff --git a/crates/oxidetalis_core/src/types/cipher.rs b/crates/oxidetalis_core/src/types/cipher.rs
index 0c44a7e..8aa8aa5 100644
--- a/crates/oxidetalis_core/src/types/cipher.rs
+++ b/crates/oxidetalis_core/src/types/cipher.rs
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Cipher types
+
use std::{fmt, str::FromStr};
use base58::{FromBase58, ToBase58};
diff --git a/crates/oxidetalis_core/src/types/impl_serde.rs b/crates/oxidetalis_core/src/types/impl_serde.rs
index 8f86905..ee091e0 100644
--- a/crates/oxidetalis_core/src/types/impl_serde.rs
+++ b/crates/oxidetalis_core/src/types/impl_serde.rs
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Serde serialization and deserialization for types (feature `serde`)
+
use base58::FromBase58;
use serde::{de::Error as DeError, Deserialize, Serialize};
diff --git a/crates/oxidetalis_entities/src/incoming_chat_requests.rs b/crates/oxidetalis_entities/src/incoming_chat_requests.rs
index 8e99585..9c55f74 100644
--- a/crates/oxidetalis_entities/src/incoming_chat_requests.rs
+++ b/crates/oxidetalis_entities/src/incoming_chat_requests.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Entity for `in_chat_requests` table
+
use chrono::Utc;
use sea_orm::entity::prelude::*;
diff --git a/crates/oxidetalis_entities/src/lib.rs b/crates/oxidetalis_entities/src/lib.rs
index 4857294..ba83d45 100644
--- a/crates/oxidetalis_entities/src/lib.rs
+++ b/crates/oxidetalis_entities/src/lib.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+#![doc = include_str!("../README.md")]
+
pub mod incoming_chat_requests;
pub mod outgoing_chat_requests;
pub mod prelude;
diff --git a/crates/oxidetalis_entities/src/outgoing_chat_requests.rs b/crates/oxidetalis_entities/src/outgoing_chat_requests.rs
index b4639ab..95ba3f1 100644
--- a/crates/oxidetalis_entities/src/outgoing_chat_requests.rs
+++ b/crates/oxidetalis_entities/src/outgoing_chat_requests.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Entity for `out_chat_requests` table
+
use chrono::Utc;
use sea_orm::entity::prelude::*;
diff --git a/crates/oxidetalis_entities/src/prelude.rs b/crates/oxidetalis_entities/src/prelude.rs
index 8e76845..4bdd679 100644
--- a/crates/oxidetalis_entities/src/prelude.rs
+++ b/crates/oxidetalis_entities/src/prelude.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Predefined imports for the entities, all the entities are re-exported here
+
pub use sea_orm::{
ActiveModelTrait,
ColumnTrait,
diff --git a/crates/oxidetalis_entities/src/users.rs b/crates/oxidetalis_entities/src/users.rs
index 32937e9..1a7692b 100644
--- a/crates/oxidetalis_entities/src/users.rs
+++ b/crates/oxidetalis_entities/src/users.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Entity for `users` table
+
use sea_orm::entity::prelude::*;
use crate::prelude::*;
diff --git a/crates/oxidetalis_entities/src/users_status.rs b/crates/oxidetalis_entities/src/users_status.rs
index c2fb388..23eab9c 100644
--- a/crates/oxidetalis_entities/src/users_status.rs
+++ b/crates/oxidetalis_entities/src/users_status.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database entities
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Entity for `users_status` table
+
use chrono::Utc;
use sea_orm::entity::prelude::*;
diff --git a/crates/oxidetalis_migrations/src/create_incoming_chat_requests_table.rs b/crates/oxidetalis_migrations/src/create_incoming_chat_requests_table.rs
index 17eb05a..1af430c 100644
--- a/crates/oxidetalis_migrations/src/create_incoming_chat_requests_table.rs
+++ b/crates/oxidetalis_migrations/src/create_incoming_chat_requests_table.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database migrations
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Migration to create the `in_chat_requests` table, a table for incoming chat
+//! requests from other users
+
use sea_orm_migration::prelude::*;
use crate::create_users_table::Users;
diff --git a/crates/oxidetalis_migrations/src/create_outgoing_chat_requests_table.rs b/crates/oxidetalis_migrations/src/create_outgoing_chat_requests_table.rs
index 9bf791d..6130d87 100644
--- a/crates/oxidetalis_migrations/src/create_outgoing_chat_requests_table.rs
+++ b/crates/oxidetalis_migrations/src/create_outgoing_chat_requests_table.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database migrations
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Migration to create the `out_chat_requests` table, a table for outgoing chat
+//! requests to other users
+
use sea_orm_migration::prelude::*;
use crate::create_users_table::Users;
diff --git a/crates/oxidetalis_migrations/src/create_users_status.rs b/crates/oxidetalis_migrations/src/create_users_status.rs
index 3f11eda..beba81b 100644
--- a/crates/oxidetalis_migrations/src/create_users_status.rs
+++ b/crates/oxidetalis_migrations/src/create_users_status.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database migrations
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Migration to create the `users_status` table, a table for storing
+//! whitelist/blacklist status of users
+
use std::fmt;
use sea_orm::sea_query::extension::postgres::Type;
diff --git a/crates/oxidetalis_migrations/src/create_users_table.rs b/crates/oxidetalis_migrations/src/create_users_table.rs
index 942bf42..d8f2956 100644
--- a/crates/oxidetalis_migrations/src/create_users_table.rs
+++ b/crates/oxidetalis_migrations/src/create_users_table.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database migrations
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+//! Migration to create the `users` table, a table for storing server users.
+
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
diff --git a/crates/oxidetalis_migrations/src/lib.rs b/crates/oxidetalis_migrations/src/lib.rs
index 4fbc114..b36dd83 100644
--- a/crates/oxidetalis_migrations/src/lib.rs
+++ b/crates/oxidetalis_migrations/src/lib.rs
@@ -1,4 +1,4 @@
-// OxideTalis Messaging Protocol homeserver core implementation
+// OxideTalis Messaging Protocol homeserver database migrations
// Copyright (C) 2024 Awiteb , OxideTalis Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,6 +19,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
+#![doc = include_str!("../README.md")]
+
use sea_orm_migration::prelude::*;
pub use sea_orm_migration::MigratorTrait;