docs: tambah doc comment, logging, dan inline comments di semua 255 file

Meliputi:
- File-level //! doc comment: tujuan file, alur kerja, komponen utama
- Function-level /// doc comment: apa, parameter, return, flow, edge cases
- Struct/enum/trait /// doc comment: peran, field docs
- Tracing logging (tracing::info!/debug!/trace!/warn!/error!) di setiap fungsi
- Inline comments untuk variable dan branching logic penting
- Seluruh 8 crates di workspace: zesdex-backend, zesdex-cms, zesdex-entities,
  zesdex-iam, zesdex-infra, zesdex-ipc, zesdex-middleware, zesdex-utils
- Build: 0 errors, 242/242 tests passed
This commit is contained in:
asepharyana
2026-07-19 17:05:47 +07:00
parent 6680795ce7
commit 5aaedbf787
255 changed files with 5666 additions and 743 deletions
@@ -1,8 +1,20 @@
//! CMS-specific DTOs (Data Transfer Objects) for the REST API.
//! Data Transfer Objects (DTOs) for the CMS REST API.
//!
//! These types define the wire format accepted and returned by HTTP handlers.
//! They are independent of the domain entities so the API contract can
//! evolve without coupling to the domain model.
//! They are intentionally independent of the domain entities so the API
//! contract can evolve without coupling to the domain model.
//!
//! ## DTOs
//! - `SettingsUpdateRequest` — partial-update body for PUT /settings
//! - `SettingsResponse` — response body for GET /settings (API keys redacted)
//! - `MemoryCreateRequest` — request body for POST /memories
//! - `MemoryResponse` — response body for memory operations
//! - `ConversationResponse` — response body for GET /conversation
//!
//! ## Conventions
//! - `From<DomainType>` impls convert domain entities → DTO responses
//! - API key values are **redacted** in responses (only key names exposed)
//! - Request fields use `Option` to support partial updates
use serde::{Deserialize, Serialize};
@@ -53,6 +65,10 @@ pub struct SettingsResponse {
pub hive_mind_node_timeout_ms: u64,
}
/// Convert a domain `Settings` entity into its API response representation.
///
/// ## Side-effects
/// - API key **values are redacted** — only key names are exposed.
impl From<crate::domain::settings::Settings> for SettingsResponse {
fn from(s: crate::domain::settings::Settings) -> Self {
Self {
@@ -112,6 +128,7 @@ pub struct MemoryResponse {
pub provenances: Vec<String>,
}
/// Convert a domain `Memory` entity into its API response representation.
impl From<crate::domain::memory::Memory> for MemoryResponse {
fn from(m: crate::domain::memory::Memory) -> Self {
Self {
@@ -146,6 +163,11 @@ pub struct ConversationResponse {
pub temperature: Option<f32>,
}
/// Convert a domain `Conversation` entity into its API response summary.
///
/// ## Note
/// Only metadata is included (message count, model, system prompt);
/// individual messages are not returned in this response.
impl From<crate::domain::conversation::Conversation> for ConversationResponse {
fn from(c: crate::domain::conversation::Conversation) -> Self {
let message_count = c.len();