2025-12-03 19:59:27 -03:00
|
|
|
//! Shared types and utilities
|
|
|
|
|
//!
|
|
|
|
|
//! This module re-exports common types from botlib and provides
|
|
|
|
|
//! botserver-specific shared functionality.
|
|
|
|
|
|
2025-11-22 22:55:35 -03:00
|
|
|
pub mod admin;
|
|
|
|
|
pub mod analytics;
|
|
|
|
|
pub mod models;
|
2025-12-03 19:59:27 -03:00
|
|
|
pub mod schema;
|
2025-11-22 22:55:35 -03:00
|
|
|
pub mod state;
|
2025-12-05 16:43:14 -03:00
|
|
|
#[cfg(test)]
|
|
|
|
|
pub mod test_utils;
|
2025-11-22 22:55:35 -03:00
|
|
|
pub mod utils;
|
2025-11-30 12:20:48 -03:00
|
|
|
|
2025-12-03 19:59:27 -03:00
|
|
|
// Re-export schema at module level for backward compatibility
|
|
|
|
|
pub use schema::*;
|
|
|
|
|
|
|
|
|
|
// Re-export from botlib for backward compatibility
|
|
|
|
|
pub use botlib::branding::{
|
|
|
|
|
branding, copyright_text, footer_text, init_branding, is_white_label, log_prefix,
|
|
|
|
|
platform_name, platform_short, BrandingConfig,
|
|
|
|
|
};
|
|
|
|
|
pub use botlib::error::{BotError, BotResult};
|
|
|
|
|
pub use botlib::message_types;
|
|
|
|
|
pub use botlib::message_types::MessageType;
|
|
|
|
|
pub use botlib::version::{
|
2025-11-30 12:20:48 -03:00
|
|
|
get_botserver_version, init_version_registry, register_component, version_string,
|
2025-12-03 19:59:27 -03:00
|
|
|
ComponentSource, ComponentStatus, ComponentVersion, VersionRegistry, BOTSERVER_NAME,
|
|
|
|
|
BOTSERVER_VERSION,
|
2025-11-30 12:20:48 -03:00
|
|
|
};
|
2025-12-03 19:59:27 -03:00
|
|
|
|
|
|
|
|
// Re-export models from botlib
|
|
|
|
|
pub use botlib::models::{ApiResponse, Attachment, Suggestion};
|
|
|
|
|
|
|
|
|
|
// Re-export BotResponse and UserMessage with full path to avoid conflicts
|
|
|
|
|
pub use botlib::models::BotResponse;
|
|
|
|
|
pub use botlib::models::Session;
|
|
|
|
|
pub use botlib::models::UserMessage;
|
|
|
|
|
|
|
|
|
|
// Local re-exports - database models
|
|
|
|
|
pub use models::{
|
|
|
|
|
Automation, Bot, BotConfiguration, BotMemory, Click, MessageHistory, NewTask, Organization,
|
|
|
|
|
Task, TriggerKind, User, UserLoginToken, UserPreference, UserSession,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Database utilities
|
|
|
|
|
pub use utils::{create_conn, DbPool};
|
|
|
|
|
|
|
|
|
|
/// Prelude module for convenient imports
|
|
|
|
|
/// Usage: `use crate::shared::prelude::*;`
|
|
|
|
|
pub mod prelude {
|
|
|
|
|
// Re-export everything commonly needed
|
|
|
|
|
pub use super::schema::*;
|
|
|
|
|
pub use super::{
|
|
|
|
|
ApiResponse, Attachment, Automation, Bot, BotConfiguration, BotError, BotMemory,
|
|
|
|
|
BotResponse, BotResult, Click, DbPool, MessageHistory, MessageType, NewTask, Organization,
|
|
|
|
|
Session, Suggestion, Task, TriggerKind, User, UserLoginToken, UserMessage, UserPreference,
|
|
|
|
|
UserSession,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Diesel prelude for database operations
|
|
|
|
|
pub use diesel::prelude::*;
|
|
|
|
|
pub use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
|
|
|
|
|
|
|
|
|
|
// Common external types
|
|
|
|
|
pub use chrono::{DateTime, Utc};
|
|
|
|
|
pub use serde::{Deserialize, Serialize};
|
|
|
|
|
pub use uuid::Uuid;
|
|
|
|
|
}
|