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,9 +1,22 @@
//! Session management use-cases.
//!
//! `SessionServiceImpl` implements `SessionService` by delegating to
//! `SessionServiceImpl` implements [`SessionService`] by delegating to
//! injected repository implementations, keeping the orchestration logic
//! independent of any concrete persistence mechanism.
//!
//! # Flow
//!
//! - **`create_session`** — generates a UUID v4 id, creates a `Session` entity,
//! delegates persistence to `SessionRepository`.
//! - **`list_all`** — delegates to `SessionRepository::list_sessions`.
//! - **`archive_session`** — loads session, sets `archived = true`, persists.
//!
//! # Components
//!
//! - `SessionServiceImpl<R, L>` — service over two generic repositories
//! - `new` / `create_session` / `list_all` / `archive_session` — lifecycle ops
use std::path::PathBuf;
use tracing;
use uuid::Uuid;
@@ -13,8 +26,11 @@ use crate::domain::session::Session;
/// Concrete session service backed by generic repository implementations.
pub struct SessionServiceImpl<R: SessionRepository, L: SessionLockRepository> {
/// Repository for session CRUD operations.
pub session_repo: R,
/// Repository for session lock acquire/release.
pub lock_repo: L,
/// Base data directory passed to repository methods.
pub base_dir: PathBuf,
}
@@ -39,15 +55,18 @@ impl<R: SessionRepository, L: SessionLockRepository> SessionService for SessionS
title.to_string()
};
let session = Session::new(id, title_owned);
tracing::debug!(session_id = %session.id, title = %session.title, "creating new session");
self.session_repo.save_session(&self.base_dir, &session)?;
Ok(session)
}
fn list_all(&self) -> anyhow::Result<Vec<Session>> {
tracing::debug!("listing all sessions");
self.session_repo.list_sessions(&self.base_dir)
}
fn archive_session(&self, id: &str) -> anyhow::Result<()> {
tracing::debug!(session_id = %id, "archiving session");
let mut session = self.session_repo.load_session(&self.base_dir, id)?;
session.archived = true;
session.updated_at = std::time::SystemTime::now()