refactor: rename redis-cache feature to cache
- Simplified feature name from 'redis-cache' to 'cache' - Updated Cargo.toml feature definitions - Updated state.rs cfg attributes - More concise naming
This commit is contained in:
parent
b1193afda2
commit
415c7cce77
4 changed files with 76 additions and 18 deletions
12
Cargo.toml
12
Cargo.toml
|
|
@ -44,7 +44,7 @@ features = ["database"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# ===== DEFAULT FEATURE SET =====
|
# ===== DEFAULT FEATURE SET =====
|
||||||
default = ["console", "chat", "automation", "tasks", "drive", "llm", "redis-cache", "progress-bars", "directory"]
|
default = ["console", "chat", "automation", "tasks", "drive", "llm", "cache", "progress-bars", "directory"]
|
||||||
|
|
||||||
# ===== UI FEATURES =====
|
# ===== UI FEATURES =====
|
||||||
console = ["dep:crossterm", "dep:ratatui", "monitoring"]
|
console = ["dep:crossterm", "dep:ratatui", "monitoring"]
|
||||||
|
|
@ -76,7 +76,7 @@ weba = []
|
||||||
timeseries = []
|
timeseries = []
|
||||||
|
|
||||||
# ===== OPTIONAL INFRASTRUCTURE =====
|
# ===== OPTIONAL INFRASTRUCTURE =====
|
||||||
redis-cache = ["dep:redis"]
|
cache = ["dep:redis"]
|
||||||
monitoring = ["dep:sysinfo"]
|
monitoring = ["dep:sysinfo"]
|
||||||
automation = ["dep:rhai"]
|
automation = ["dep:rhai"]
|
||||||
grpc = ["dep:tonic"]
|
grpc = ["dep:tonic"]
|
||||||
|
|
@ -89,11 +89,11 @@ full = [
|
||||||
"email", "whatsapp", "instagram", "msteams",
|
"email", "whatsapp", "instagram", "msteams",
|
||||||
"chat", "drive", "tasks", "calendar", "meet", "mail",
|
"chat", "drive", "tasks", "calendar", "meet", "mail",
|
||||||
"compliance", "attendance", "directory", "weba",
|
"compliance", "attendance", "directory", "weba",
|
||||||
"redis-cache", "monitoring", "automation", "grpc", "progress-bars"
|
"cache", "monitoring", "automation", "grpc", "progress-bars"
|
||||||
]
|
]
|
||||||
|
|
||||||
communications = ["email", "whatsapp", "instagram", "msteams", "chat", "redis-cache"]
|
communications = ["email", "whatsapp", "instagram", "msteams", "chat", "cache"]
|
||||||
productivity = ["chat", "drive", "tasks", "calendar", "meet", "mail", "redis-cache"]
|
productivity = ["chat", "drive", "tasks", "calendar", "meet", "mail", "cache"]
|
||||||
enterprise = ["compliance", "attendance", "directory", "llm", "vectordb", "monitoring", "timeseries"]
|
enterprise = ["compliance", "attendance", "directory", "llm", "vectordb", "monitoring", "timeseries"]
|
||||||
minimal = ["chat"]
|
minimal = ["chat"]
|
||||||
lightweight = ["chat", "drive", "tasks"]
|
lightweight = ["chat", "drive", "tasks"]
|
||||||
|
|
@ -204,7 +204,7 @@ rust_xlsxwriter = "0.79"
|
||||||
# Error handling
|
# Error handling
|
||||||
thiserror = "2.0"
|
thiserror = "2.0"
|
||||||
|
|
||||||
# Caching/Sessions (redis-cache feature)
|
# Caching/Sessions (cache feature)
|
||||||
redis = { version = "0.27", features = ["tokio-comp"], optional = true }
|
redis = { version = "0.27", features = ["tokio-comp"], optional = true }
|
||||||
|
|
||||||
# System Monitoring (monitoring feature)
|
# System Monitoring (monitoring feature)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use aws_sdk_s3::primitives::ByteStream;
|
use aws_sdk_s3::primitives::ByteStream;
|
||||||
use aws_sdk_s3::Client;
|
use aws_sdk_s3::Client;
|
||||||
|
use chrono::TimeZone;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,69 @@
|
||||||
//! REST API Module
|
//! Attendance Module
|
||||||
//!
|
//!
|
||||||
//! Provides HTTP endpoints for cloud-based functionality.
|
//! Provides attendance tracking and human handoff queue functionality.
|
||||||
//! Supports web, desktop, and mobile clients.
|
|
||||||
//!
|
//!
|
||||||
//! Note: Local operations require native access and are handled separately:
|
//! ## Features
|
||||||
//! - Screen capture: Tauri commands (desktop) or WebRTC (web/mobile)
|
//!
|
||||||
//! - File sync: Tauri commands with local rclone process (desktop only)
|
//! - **Queue System**: Human handoff for conversations that need human attention
|
||||||
|
//! - **Keyword Services**: Check-in/out, break/resume tracking via keywords
|
||||||
|
//! - **Drive Integration**: S3 storage for attendance records
|
||||||
|
//!
|
||||||
|
//! ## Usage
|
||||||
|
//!
|
||||||
|
//! Enable with the `attendance` feature flag in Cargo.toml:
|
||||||
|
//! ```toml
|
||||||
|
//! [features]
|
||||||
|
//! default = ["attendance"]
|
||||||
|
//! ```
|
||||||
|
|
||||||
// pub mod drive;
|
pub mod drive;
|
||||||
// pub mod keyword_services;
|
pub mod keyword_services;
|
||||||
pub mod queue;
|
pub mod queue;
|
||||||
|
|
||||||
|
// Re-export main types for convenience
|
||||||
|
pub use drive::{AttendanceDriveConfig, AttendanceDriveService, RecordMetadata, SyncResult};
|
||||||
|
pub use keyword_services::{
|
||||||
|
AttendanceCommand, AttendanceRecord, AttendanceResponse, AttendanceService, KeywordConfig,
|
||||||
|
KeywordParser, ParsedCommand,
|
||||||
|
};
|
||||||
|
pub use queue::{
|
||||||
|
AssignRequest, AttendantStats, AttendantStatus, QueueFilters, QueueItem, QueueStatus,
|
||||||
|
TransferRequest,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::shared::state::AppState;
|
||||||
|
use axum::{
|
||||||
|
routing::{get, post},
|
||||||
|
Router,
|
||||||
|
};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
/// Configure attendance routes
|
||||||
|
pub fn configure_attendance_routes() -> Router<Arc<AppState>> {
|
||||||
|
Router::new()
|
||||||
|
// Queue management endpoints
|
||||||
|
.route("/api/attendance/queue", get(queue::list_queue))
|
||||||
|
.route("/api/attendance/attendants", get(queue::list_attendants))
|
||||||
|
.route("/api/attendance/assign", post(queue::assign_conversation))
|
||||||
|
.route(
|
||||||
|
"/api/attendance/transfer",
|
||||||
|
post(queue::transfer_conversation),
|
||||||
|
)
|
||||||
|
.route(
|
||||||
|
"/api/attendance/resolve/:session_id",
|
||||||
|
post(queue::resolve_conversation),
|
||||||
|
)
|
||||||
|
.route("/api/attendance/insights", get(queue::get_insights))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_module_exports() {
|
||||||
|
// Test that types are properly exported
|
||||||
|
let _config = KeywordConfig::default();
|
||||||
|
let _parser = KeywordParser::new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use crate::shared::utils::DbPool;
|
||||||
use crate::tasks::{TaskEngine, TaskScheduler};
|
use crate::tasks::{TaskEngine, TaskScheduler};
|
||||||
#[cfg(feature = "drive")]
|
#[cfg(feature = "drive")]
|
||||||
use aws_sdk_s3::Client as S3Client;
|
use aws_sdk_s3::Client as S3Client;
|
||||||
#[cfg(feature = "redis-cache")]
|
#[cfg(feature = "cache")]
|
||||||
use redis::Client as RedisClient;
|
use redis::Client as RedisClient;
|
||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
@ -85,7 +85,7 @@ pub struct AppState {
|
||||||
#[cfg(feature = "drive")]
|
#[cfg(feature = "drive")]
|
||||||
pub drive: Option<S3Client>,
|
pub drive: Option<S3Client>,
|
||||||
pub s3_client: Option<S3Client>,
|
pub s3_client: Option<S3Client>,
|
||||||
#[cfg(feature = "redis-cache")]
|
#[cfg(feature = "cache")]
|
||||||
pub cache: Option<Arc<RedisClient>>,
|
pub cache: Option<Arc<RedisClient>>,
|
||||||
pub bucket_name: String,
|
pub bucket_name: String,
|
||||||
pub config: Option<AppConfig>,
|
pub config: Option<AppConfig>,
|
||||||
|
|
@ -117,7 +117,7 @@ impl Clone for AppState {
|
||||||
config: self.config.clone(),
|
config: self.config.clone(),
|
||||||
conn: self.conn.clone(),
|
conn: self.conn.clone(),
|
||||||
database_url: self.database_url.clone(),
|
database_url: self.database_url.clone(),
|
||||||
#[cfg(feature = "redis-cache")]
|
#[cfg(feature = "cache")]
|
||||||
cache: self.cache.clone(),
|
cache: self.cache.clone(),
|
||||||
session_manager: Arc::clone(&self.session_manager),
|
session_manager: Arc::clone(&self.session_manager),
|
||||||
metrics_collector: self.metrics_collector.clone(),
|
metrics_collector: self.metrics_collector.clone(),
|
||||||
|
|
@ -146,7 +146,7 @@ impl std::fmt::Debug for AppState {
|
||||||
|
|
||||||
debug.field("s3_client", &self.s3_client.is_some());
|
debug.field("s3_client", &self.s3_client.is_some());
|
||||||
|
|
||||||
#[cfg(feature = "redis-cache")]
|
#[cfg(feature = "cache")]
|
||||||
debug.field("cache", &self.cache.is_some());
|
debug.field("cache", &self.cache.is_some());
|
||||||
|
|
||||||
debug
|
debug
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue