Skip to main content

ito_domain/modules/
mod.rs

1//! Module domain models and repository.
2//!
3//! This module provides domain models for Ito modules and a repository
4//! for loading and querying module data.
5
6mod repository;
7
8pub use repository::ModuleRepository;
9
10use std::path::PathBuf;
11
12/// Full module with metadata loaded.
13#[derive(Debug, Clone)]
14pub struct Module {
15    /// Module identifier (e.g., "005")
16    pub id: String,
17    /// Module name (e.g., "dev-tooling")
18    pub name: String,
19    /// Optional description
20    pub description: Option<String>,
21    /// Path to the module directory
22    pub path: PathBuf,
23}
24
25/// Lightweight module summary for listings.
26#[derive(Debug, Clone)]
27pub struct ModuleSummary {
28    /// Module identifier
29    pub id: String,
30    /// Module name
31    pub name: String,
32    /// Number of changes in this module
33    pub change_count: u32,
34}
35
36#[cfg(test)]
37mod tests {
38    use super::*;
39
40    #[test]
41    fn test_module_creation() {
42        let module = Module {
43            id: "005".to_string(),
44            name: "dev-tooling".to_string(),
45            description: Some("Development tooling".to_string()),
46            path: PathBuf::from("/test"),
47        };
48
49        assert_eq!(module.id, "005");
50        assert_eq!(module.name, "dev-tooling");
51    }
52
53    #[test]
54    fn test_module_summary() {
55        let summary = ModuleSummary {
56            id: "005".to_string(),
57            name: "dev-tooling".to_string(),
58            change_count: 3,
59        };
60
61        assert_eq!(summary.change_count, 3);
62    }
63}