botserver/src/paper/mod.rs
Rodrigo Rodriguez 5ea171d126
Some checks failed
BotServer CI / build (push) Failing after 1m34s
Refactor: Split large files into modular subdirectories
Split 20+ files over 1000 lines into focused subdirectories for better
maintainability and code organization. All changes maintain backward
compatibility through re-export wrappers.

Major splits:
- attendance/llm_assist.rs (2074→7 modules)
- basic/keywords/face_api.rs → face_api/ (7 modules)
- basic/keywords/file_operations.rs → file_ops/ (8 modules)
- basic/keywords/hear_talk.rs → hearing/ (6 modules)
- channels/wechat.rs → wechat/ (10 modules)
- channels/youtube.rs → youtube/ (5 modules)
- contacts/mod.rs → contacts_api/ (6 modules)
- core/bootstrap/mod.rs → bootstrap/ (5 modules)
- core/shared/admin.rs → admin_*.rs (5 modules)
- designer/canvas.rs → canvas_api/ (6 modules)
- designer/mod.rs → designer_api/ (6 modules)
- docs/handlers.rs → handlers_api/ (11 modules)
- drive/mod.rs → drive_handlers.rs, drive_types.rs
- learn/mod.rs → types.rs
- main.rs → main_module/ (7 modules)
- meet/webinar.rs → webinar_api/ (8 modules)
- paper/mod.rs → (10 modules)
- security/auth.rs → auth_api/ (7 modules)
- security/passkey.rs → (4 modules)
- sources/mod.rs → sources_api/ (5 modules)
- tasks/mod.rs → task_api/ (5 modules)

Stats: 38,040 deletions, 1,315 additions across 318 files

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 21:09:30 +00:00

81 lines
3.2 KiB
Rust

// Paper module - document management system
// This module has been split into submodules for better organization
pub mod ai_handlers;
pub mod auth;
pub mod export;
pub mod handlers;
pub mod llm;
pub mod models;
pub mod storage;
pub mod templates;
pub mod utils;
// Re-export public types and functions for backward compatibility
pub use models::*;
pub use auth::get_current_user;
pub use storage::{
delete_document_from_drive, list_documents_from_drive, load_document_from_drive,
save_document_to_drive,
};
pub use llm::call_llm;
pub use handlers::{
handle_autosave, handle_delete_document, handle_get_document, handle_list_documents,
handle_new_document, handle_save_document, handle_search_documents,
};
pub use templates::{
handle_template_blank, handle_template_letter, handle_template_meeting,
handle_template_report, handle_template_research, handle_template_todo,
};
pub use ai_handlers::{
handle_ai_custom, handle_ai_expand, handle_ai_improve, handle_ai_simplify,
handle_ai_summarize, handle_ai_translate,
};
pub use export::{
handle_export_docx, handle_export_html, handle_export_md, handle_export_pdf,
handle_export_txt,
};
pub use utils::{
format_ai_response, format_document_content, format_document_list_item, format_error,
format_relative_time, html_escape, markdown_to_html, strip_markdown,
};
use axum::{routing::{get, post}, Router};
use std::sync::Arc;
use crate::core::shared::state::AppState;
use crate::core::urls::ApiUrls;
pub fn configure_paper_routes() -> Router<Arc<AppState>> {
Router::new()
.route(ApiUrls::PAPER_NEW, post(handle_new_document))
.route(ApiUrls::PAPER_LIST, get(handle_list_documents))
.route(ApiUrls::PAPER_SEARCH, get(handle_search_documents))
.route(ApiUrls::PAPER_SAVE, post(handle_save_document))
.route(ApiUrls::PAPER_AUTOSAVE, post(handle_autosave))
.route(ApiUrls::PAPER_BY_ID, get(handle_get_document))
.route(ApiUrls::PAPER_DELETE, post(handle_delete_document))
.route(ApiUrls::PAPER_TEMPLATE_BLANK, post(handle_template_blank))
.route(ApiUrls::PAPER_TEMPLATE_MEETING, post(handle_template_meeting))
.route(ApiUrls::PAPER_TEMPLATE_TODO, post(handle_template_todo))
.route(
ApiUrls::PAPER_TEMPLATE_RESEARCH,
post(handle_template_research),
)
.route(ApiUrls::PAPER_TEMPLATE_REPORT, post(handle_template_report))
.route(ApiUrls::PAPER_TEMPLATE_LETTER, post(handle_template_letter))
.route(ApiUrls::PAPER_AI_SUMMARIZE, post(handle_ai_summarize))
.route(ApiUrls::PAPER_AI_EXPAND, post(handle_ai_expand))
.route(ApiUrls::PAPER_AI_IMPROVE, post(handle_ai_improve))
.route(ApiUrls::PAPER_AI_SIMPLIFY, post(handle_ai_simplify))
.route(ApiUrls::PAPER_AI_TRANSLATE, post(handle_ai_translate))
.route(ApiUrls::PAPER_AI_CUSTOM, post(handle_ai_custom))
.route(ApiUrls::PAPER_EXPORT_PDF, get(handle_export_pdf))
.route(ApiUrls::PAPER_EXPORT_DOCX, get(handle_export_docx))
.route(ApiUrls::PAPER_EXPORT_MD, get(handle_export_md))
.route(ApiUrls::PAPER_EXPORT_HTML, get(handle_export_html))
.route(ApiUrls::PAPER_EXPORT_TXT, get(handle_export_txt))
}