@@ -8,30 +8,110 @@ This is a Rust-based file classification solution that adopts a modular architec
88FileClassificationSolutions/
99├── .github/ # GitHub related configurations
1010│ └── workflows/ # CI/CD workflow configurations
11+ ├── common/ # Common module
12+ │ ├── src/ # Source code
13+ │ │ ├── env_loader.rs # Environment variable loader
14+ │ │ └── lib.rs # Library entry point
15+ │ └── Cargo.toml # Package configuration
1116├── file_classification_cli/ # Command-line interface application
12- │ ├── src/bin/ # Various independent command-line tools
17+ │ ├── example/ # Example script files
18+ │ │ ├── hierarchical_classification.fcc
19+ │ │ ├── hybrid_classification.fcc
20+ │ │ ├── tag_based_classification.fcc
21+ │ │ └── website_classification.fcc
22+ │ ├── src/ # Source code
23+ │ │ ├── cli.rs # CLI command parsing
24+ │ │ ├── context.rs # Context management
25+ │ │ ├── handlers.rs # Command handlers
26+ │ │ ├── helpers.rs # Helper functions
27+ │ │ ├── interactive.rs # Interactive features
28+ │ │ ├── main.rs # Application entry point
29+ │ │ ├── parsers.rs # Parsers
30+ │ │ ├── repl.rs # REPL implementation
31+ │ │ └── utils.rs # Utility functions
32+ │ ├── tests/ # Test code
33+ │ │ └── cli.rs
1334│ └── Cargo.toml # CLI package configuration
1435├── file_classification_core/ # Core library
1536│ ├── src/
16- │ │ ├── internal/ # Data access layer
17- │ │ ├── model/ # Data models and database schema
37+ │ │ ├── internal/ # Data access layer (DAO)
38+ │ │ │ ├── file_group.rs # File-group association data access
39+ │ │ │ ├── files.rs # File data access
40+ │ │ │ ├── group_relations.rs # Group relations data access
41+ │ │ │ ├── group_tag.rs # Group-tag association data access
42+ │ │ │ ├── groups.rs # Group data access
43+ │ │ │ ├── mod.rs # Module declarations
44+ │ │ │ └── tags.rs # Tag data access
45+ │ │ ├── model/ # Data models
46+ │ │ │ ├── mod.rs # Module declarations
47+ │ │ │ ├── models.rs # All data structure definitions
48+ │ │ │ └── schema.rs # Database schema (generated by Diesel)
1849│ │ ├── service/ # Business logic layer
19- │ │ └── utils/ # Utility functions
50+ │ │ │ ├── file_group.rs # File-group association business logic
51+ │ │ │ ├── files.rs # File business logic
52+ │ │ │ ├── group_relations.rs # Group relations business logic
53+ │ │ │ ├── group_tag.rs # Group-tag association business logic
54+ │ │ │ ├── groups.rs # Group business logic
55+ │ │ │ ├── mod.rs # Module declarations
56+ │ │ │ └── tags.rs # Tag business logic
57+ │ │ ├── utils/ # Utility functions
58+ │ │ │ ├── database.rs # Database connection management
59+ │ │ │ ├── errors.rs # Error handling
60+ │ │ │ └── mod.rs # Module declarations
61+ │ │ └── lib.rs # Library entry point
2062│ └── Cargo.toml # Core library package configuration
2163├── file_classification_webapi/ # Web API
22- │ ├── src/
64+ │ ├── src/bin/ # Binary files
2365│ │ ├── handlers/ # API request handler functions
24- │ │ ├── files.rs # File API handlers
25- │ │ ├── group_tags.rs # Group-tag association API handlers
26- │ │ ├── groups.rs # Group API handlers
27- │ │ ├── mod.rs # Module declarations
28- │ │ └── tags.rs # Tag API handlers
29- │ ├── utils/ # Web API utility functions
30- │ │ ├── database.rs # Database connection pool
31- │ │ ├── mod.rs # Module declarations
32- │ │ └── models.rs # API data transfer objects
66+ │ │ │ ├── file_groups.rs # File-group association API handlers
67+ │ │ │ ├── files.rs # File API handlers
68+ │ │ │ ├── group_relations.rs # Group relations API handlers
69+ │ │ │ ├── group_tags.rs # Group-tag association API handlers
70+ │ │ │ ├── groups.rs # Group API handlers
71+ │ │ │ ├── mod.rs # Module declarations
72+ │ │ │ ├── tags.rs # Tag API handlers
73+ │ │ │ └── uploads.rs # File upload API handlers
74+ │ │ ├── utils/ # Web API utility functions
75+ │ │ │ ├── app_config.rs # Application configuration
76+ │ │ │ ├── cors.rs # CORS configuration
77+ │ │ │ ├── database.rs # Database connection pool
78+ │ │ │ ├── logger.rs # Logger configuration
79+ │ │ │ ├── mod.rs # Module declarations
80+ │ │ │ ├── models.rs # API data transfer objects
81+ │ │ │ ├── server.rs # Server configuration
82+ │ │ │ └── static_files.rs # Static file serving
83+ │ │ └── file_classification_webapi.rs # Web API entry point
84+ │ ├── static/ # Static assets
85+ │ │ ├── js/ # JavaScript files
86+ │ │ │ ├── config.js
87+ │ │ │ ├── fileGroupManager.js
88+ │ │ │ ├── fileManager.js
89+ │ │ │ ├── groupManager.js
90+ │ │ │ ├── groupRelationManager.js
91+ │ │ │ ├── groupTagManager.js
92+ │ │ │ ├── loader.js
93+ │ │ │ ├── main.js
94+ │ │ │ ├── tagManager.js
95+ │ │ │ └── utils.js
96+ │ │ ├── partials/ # HTML partials
97+ │ │ │ ├── file-groups.html
98+ │ │ │ ├── files.html
99+ │ │ │ ├── group-relations.html
100+ │ │ │ ├── group-tags.html
101+ │ │ │ ├── groups.html
102+ │ │ │ ├── header.html
103+ │ │ │ ├── home.html
104+ │ │ │ ├── modal.html
105+ │ │ │ ├── sidebar.html
106+ │ │ │ └── tags.html
107+ │ │ ├── index.html # Main page
108+ │ │ ├── styles.css # Stylesheet
109+ │ │ └── favicon.ico # Favicon
33110│ └── Cargo.toml # Web API package configuration
34- ├── migrations/ # Database migration scripts
111+ ├── migrations/ # Diesel database migrations
112+ ├── migrations_mysql/ # MySQL database migrations
113+ ├── migrations_postgres/ # PostgreSQL database migrations
114+ ├── migrations_sqlite/ # SQLite database migrations
35115└── nix/ # Nix package management configuration
36116```
37117
@@ -49,21 +129,28 @@ file_classification_core/
49129│ ├── internal/ # Data access layer (DAO)
50130│ │ ├── file_group.rs # File-group association data access
51131│ │ ├── files.rs # File data access
132+ │ │ ├── group_relations.rs # Group relations data access
52133│ │ ├── group_tag.rs # Group-tag association data access
53134│ │ ├── groups.rs # Group data access
135+ │ │ ├── mod.rs # Module declarations
54136│ │ └── tags.rs # Tag data access
55137│ ├── model/ # Data models
138+ │ │ ├── mod.rs # Module declarations
56139│ │ ├── models.rs # All data structure definitions
57140│ │ └── schema.rs # Database schema (generated by Diesel)
58141│ ├── service/ # Business logic layer
59142│ │ ├── file_group.rs # File-group association business logic
60143│ │ ├── files.rs # File business logic
144+ │ │ ├── group_relations.rs # Group relations business logic
61145│ │ ├── group_tag.rs # Group-tag association business logic
62146│ │ ├── groups.rs # Group business logic
147+ │ │ ├── mod.rs # Module declarations
63148│ │ └── tags.rs # Tag business logic
64- │ └── utils/ # Utility functions
65- │ ├── database.rs # Database connection management
66- │ └── errors.rs # Error handling
149+ │ ├── utils/ # Utility functions
150+ │ │ ├── database.rs # Database connection management
151+ │ │ ├── errors.rs # Error handling
152+ │ │ └── mod.rs # Module declarations
153+ │ └── lib.rs # Library entry point
67154└── Cargo.toml # Package configuration file
68155```
69156
@@ -89,36 +176,33 @@ Provides command-line tools to operate the file classification system.
89176#### Directory Structure
90177```
91178file_classification_cli/
92- ├── src/bin/ # Various independent command-line tools
93- │ ├── create_file_group.rs # Create file-group association
94- │ ├── create_group.rs # Create group
95- │ ├── create_group_tag.rs # Create group-tag association
96- │ ├── create_tag.rs # Create tag
97- │ ├── delete_file.rs # Delete file
98- │ ├── delete_file_group.rs # Delete file-group association
99- │ ├── delete_group.rs # Delete group
100- │ ├── delete_group_tag.rs # Delete group-tag association
101- │ ├── delete_tag.rs # Delete tag
102- │ ├── list_file_groups_by_conditions.rs # Query file-group associations by conditions
103- │ ├── list_files.rs # List files
104- │ ├── list_files_by_conditions.rs # Query files by conditions
105- │ ├── list_group_tags_by_conditions.rs # Query group-tag associations by conditions
106- │ ├── list_groups.rs # List groups
107- │ ├── list_groups_by_conditions.rs # Query groups by conditions
108- │ ├── list_tags.rs # List tags
109- │ ├── list_tags_by_conditions.rs # Query tags by conditions
110- │ ├── update_files_by_conditions.rs # Update files by conditions
111- │ ├── update_groups_by_conditions.rs # Update groups by conditions
112- │ └── update_tags_by_conditions.rs # Update tags by conditions
179+ ├── example/ # Example script files
180+ │ ├── hierarchical_classification.fcc
181+ │ ├── hybrid_classification.fcc
182+ │ ├── tag_based_classification.fcc
183+ │ └── website_classification.fcc
184+ ├── src/ # Source code
185+ │ ├── cli.rs # CLI command parsing
186+ │ ├── context.rs # Context management
187+ │ ├── handlers.rs # Command handlers
188+ │ ├── helpers.rs # Helper functions
189+ │ ├── interactive.rs # Interactive features
190+ │ ├── main.rs # Application entry point
191+ │ ├── parsers.rs # Parsers
192+ │ ├── repl.rs # REPL implementation
193+ │ └── utils.rs # Utility functions
194+ ├── tests/ # Test code
195+ │ └── cli.rs
113196└── Cargo.toml # Package configuration file
114197```
115198
116199
117200#### Features
118- - Provides interactive command-line interface
201+ - Provides interactive command-line interface and REPL environment
119202- Supports complex conditional queries and batch operations
120203- Includes complete CRUD functionality
121204- Supports combined condition queries (AND, OR, NOT)
205+ - Provides multiple classification scheme example configurations
122206
123207### file_classification_webapi (Web API)
124208
@@ -127,19 +211,52 @@ RESTful API service built on the Actix-web framework.
127211#### Directory Structure
128212```
129213file_classification_webapi/
130- ├── src/
214+ ├── src/bin/
131215│ ├── handlers/ # API request handler functions
132216│ │ ├── file_groups.rs # File-group association API handlers
133217│ │ ├── files.rs # File API handlers
218+ │ │ ├── group_relations.rs # Group relations API handlers
134219│ │ ├── group_tags.rs # Group-tag association API handlers
135220│ │ ├── groups.rs # Group API handlers
136221│ │ ├── mod.rs # Module declarations
137- │ │ └── tags.rs # Tag API handlers
222+ │ │ ├── tags.rs # Tag API handlers
223+ │ │ └── uploads.rs # File upload API handlers
138224│ ├── utils/ # Web API utility functions
225+ │ │ ├── app_config.rs # Application configuration
226+ │ │ ├── cors.rs # CORS configuration
139227│ │ ├── database.rs # Database connection pool
228+ │ │ ├── logger.rs # Logger configuration
140229│ │ ├── mod.rs # Module declarations
141- │ │ └── models.rs # API data transfer objects
142- │ └── main.rs # Application entry point
230+ │ │ ├── models.rs # API data transfer objects
231+ │ │ ├── server.rs # Server configuration
232+ │ │ └── static_files.rs # Static file serving
233+ │ └── file_classification_webapi.rs # Web API entry point
234+ ├── static/ # Static assets
235+ │ ├── js/ # JavaScript files
236+ │ │ ├── config.js
237+ │ │ ├── fileGroupManager.js
238+ │ │ ├── fileManager.js
239+ │ │ ├── groupManager.js
240+ │ │ ├── groupRelationManager.js
241+ │ │ ├── groupTagManager.js
242+ │ │ ├── loader.js
243+ │ │ ├── main.js
244+ │ │ ├── tagManager.js
245+ │ │ └── utils.js
246+ │ ├── partials/ # HTML partials
247+ │ │ ├── file-groups.html
248+ │ │ ├── files.html
249+ │ │ ├── group-relations.html
250+ │ │ ├── group-tags.html
251+ │ │ ├── groups.html
252+ │ │ ├── header.html
253+ │ │ ├── home.html
254+ │ │ ├── modal.html
255+ │ │ ├── sidebar.html
256+ │ │ └── tags.html
257+ │ ├── index.html # Main page
258+ │ ├── styles.css # Stylesheet
259+ │ └── favicon.ico # Favicon
143260└── Cargo.toml # Package configuration file
144261```
145262
@@ -150,16 +267,31 @@ file_classification_webapi/
150267- ** Tag Management** : ` /api/tags `
151268- ** File-Group Association** : ` /api/file-groups `
152269- ** Group-Tag Association** : ` /api/group-tags `
270+ - ** Group Relations** : ` /api/group-relations `
271+ - ** File Uploads** : ` /api/uploads `
153272
154273### Database Migrations
155274
275+ The project supports multiple databases, with corresponding migration scripts for each:
276+
277+ ```
278+ migrations/ # Diesel default migrations
279+ migrations_mysql/ # MySQL migrations
280+ migrations_postgres/ # PostgreSQL migrations
281+ migrations_sqlite/ # SQLite migrations
282+ ```
283+
284+ Each migration directory contains:
156285```
157- migrations/
158286└── 2024-10-01-193345_FileClassification/
159287 ├── up.sql # Database table creation script
160288 └── down.sql # Database table deletion script
161289```
162290
291+ Subsequent migrations:
292+ - ` 2025-10-20-000000_update_group_hierarchy ` - Update group hierarchy
293+ - ` 2025-11-02-000000_add_description_fields ` - Add description fields
294+
163295
164296Database contains the following tables:
165297- ` files ` : Stores file information
0 commit comments