Update botserver submodule
This commit is contained in:
parent
5126c648ff
commit
4f63065da2
8 changed files with 272 additions and 276 deletions
63
Cargo.toml
63
Cargo.toml
|
|
@ -2,44 +2,42 @@
|
||||||
name = "botserver"
|
name = "botserver"
|
||||||
version = "6.1.0"
|
version = "6.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
resolver = "2" # Better feature resolution
|
resolver = "2"
|
||||||
|
|
||||||
[dependencies.botlib]
|
[dependencies.botlib]
|
||||||
path = "../botlib"
|
path = "../botlib"
|
||||||
# Remove features here - control them in botlib's Cargo.toml
|
features = ["database", "i18n"]
|
||||||
# features = ["database", "i18n"] # BAD - causes full recompile
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# ===== SINGLE DEFAULT FEATURE SET =====
|
# ===== SINGLE DEFAULT FEATURE SET =====
|
||||||
default = ["chat", "drive", "tasks", "automation", "cache"]
|
default = ["chat", "drive", "tasks", "automation", "cache", "communications", "productivity"]
|
||||||
|
|
||||||
# ===== COMMUNICATION APPS =====
|
# ===== COMMUNICATION APPS =====
|
||||||
chat = ["botlib/chat"] # Delegate to botlib
|
chat = []
|
||||||
people = []
|
people = []
|
||||||
mail = ["botlib/mail"] # Delegate optional deps to botlib
|
mail = ["dep:lettre","dep:mailparse", "dep:imap", "dep:native-tls"]
|
||||||
meet = ["dep:livekit"]
|
meet = ["dep:livekit"]
|
||||||
social = []
|
social = []
|
||||||
whatsapp = []
|
whatsapp = []
|
||||||
telegram = []
|
telegram = []
|
||||||
instagram = []
|
instagram = []
|
||||||
msteams = []
|
msteams = []
|
||||||
# CONSIDER: Do you REALLY need this mega-feature?
|
|
||||||
communications = ["chat", "people", "mail", "meet", "social", "whatsapp", "telegram", "instagram", "msteams", "cache"]
|
communications = ["chat", "people", "mail", "meet", "social", "whatsapp", "telegram", "instagram", "msteams", "cache"]
|
||||||
|
|
||||||
# ===== PRODUCTIVITY APPS =====
|
# ===== PRODUCTIVITY APPS =====
|
||||||
calendar = []
|
calendar = []
|
||||||
tasks = ["dep:cron"]
|
tasks = ["dep:cron"]
|
||||||
project = []
|
project=["quick-xml"]
|
||||||
goals = []
|
goals = []
|
||||||
workspace = []
|
workspace = []
|
||||||
productivity = ["calendar", "tasks", "project", "goals", "workspace", "cache"]
|
productivity = ["calendar", "tasks", "project", "goals", "workspace", "cache"]
|
||||||
|
|
||||||
# ===== DOCUMENT APPS =====
|
# ===== DOCUMENT APPS =====
|
||||||
paper = ["docs", "dep:pdf-extract"] # Reuse docs
|
paper = ["docs", "dep:pdf-extract"]
|
||||||
docs = ["docx-rs", "ooxmlsdk"]
|
docs = ["docx-rs", "ooxmlsdk"]
|
||||||
sheet = ["calamine", "spreadsheet-ods"] # Reduced - pick one Excel lib
|
sheet = ["calamine", "spreadsheet-ods"]
|
||||||
slides = ["ooxmlsdk"]
|
slides = ["ooxmlsdk"]
|
||||||
drive = ["dep:aws-config", "dep:aws-sdk-s3", "dep:pdf-extract", "dep:flate2"]
|
drive = ["dep:aws-config", "dep:aws-sdk-s3", "dep:pdf-extract"]
|
||||||
documents = ["paper", "docs", "sheet", "slides", "drive"]
|
documents = ["paper", "docs", "sheet", "slides", "drive"]
|
||||||
|
|
||||||
# ===== MEDIA APPS =====
|
# ===== MEDIA APPS =====
|
||||||
|
|
@ -76,27 +74,21 @@ admin = ["attendant", "security", "settings"]
|
||||||
llm = []
|
llm = []
|
||||||
vectordb = ["dep:qdrant-client"]
|
vectordb = ["dep:qdrant-client"]
|
||||||
nvidia = []
|
nvidia = []
|
||||||
email = []
|
|
||||||
cache = ["dep:redis"]
|
cache = ["dep:redis"]
|
||||||
compliance = ["dep:csv"]
|
compliance = ["dep:csv"]
|
||||||
timeseries = []
|
timeseries = []
|
||||||
weba = []
|
weba = []
|
||||||
directory = []
|
directory = []
|
||||||
progress-bars = ["dep:indicatif"]
|
progress-bars = ["dep:indicatif"]
|
||||||
grpc = ["dep:tonic"]
|
grpc = []
|
||||||
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
|
jemalloc = ["dep:tikv-jemallocator", "dep:tikv-jemalloc-ctl"]
|
||||||
console = ["dep:crossterm", "dep:ratatui", "monitoring"]
|
console = ["dep:crossterm", "dep:ratatui", "monitoring"]
|
||||||
|
|
||||||
# ===== BUNDLE FEATURES =====
|
# ===== BUNDLE FEATURES =====
|
||||||
# REDUCED VERSION - Enable only what you actually use
|
|
||||||
full = [
|
full = [
|
||||||
# Communication
|
|
||||||
"chat", "people", "mail",
|
"chat", "people", "mail",
|
||||||
# Productivity
|
|
||||||
"tasks", "calendar",
|
"tasks", "calendar",
|
||||||
# Documents
|
|
||||||
"drive", "docs",
|
"drive", "docs",
|
||||||
# Core tech
|
|
||||||
"llm", "cache", "compliance"
|
"llm", "cache", "compliance"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -104,19 +96,20 @@ minimal = ["chat"]
|
||||||
lightweight = ["chat", "drive", "tasks", "people"]
|
lightweight = ["chat", "drive", "tasks", "people"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# === CORE RUNTIME (Minimal) ===
|
# === CORE RUNTIME ===
|
||||||
aes-gcm = "0.10"
|
aes-gcm = "0.10"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
argon2 = "0.5"
|
argon2 = "0.5"
|
||||||
async-lock = "2.8.0"
|
async-lock = "2.8.0"
|
||||||
async-stream = "0.3"
|
async-stream = "0.3"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
axum = { version = "0.7.5", default-features = false, features = [] } # NO defaults!
|
axum = { version = "0.7.5", features = ["ws", "multipart", "macros"] }
|
||||||
|
axum-server = { version = "0.7", features = ["tls-rustls"] }
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
bytes = "1.8"
|
bytes = "1.8"
|
||||||
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
|
||||||
color-eyre = "0.6.5"
|
color-eyre = "0.6.5"
|
||||||
diesel = { version = "2.1", default-features = false, features = ["postgres", "r2d2"] } # MINIMAL!
|
diesel = { version = "2.1", features = ["postgres", "uuid", "chrono", "serde_json", "r2d2", "numeric", "32-column-tables"] }
|
||||||
bigdecimal = { version = "0.4", default-features = false }
|
bigdecimal = { version = "0.4", default-features = false }
|
||||||
diesel_migrations = "2.1.0"
|
diesel_migrations = "2.1.0"
|
||||||
dirs = "5.0"
|
dirs = "5.0"
|
||||||
|
|
@ -134,16 +127,16 @@ num-format = "0.4"
|
||||||
once_cell = "1.18.0"
|
once_cell = "1.18.0"
|
||||||
rand = "0.9.2"
|
rand = "0.9.2"
|
||||||
regex = "1.11"
|
regex = "1.11"
|
||||||
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } # Reduced
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "multipart"] }
|
||||||
serde = { version = "1.0", default-features = false, features = ["derive", "std"] }
|
serde = { version = "1.0", default-features = false, features = ["derive", "std"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
sha2 = "0.10.9"
|
sha2 = "0.10.9"
|
||||||
sha1 = "0.10.6"
|
sha1 = "0.10.6"
|
||||||
tokio = { version = "1.41", default-features = false, features = ["rt", "sync", "time", "macros", "net"] }
|
tokio = { version = "1.41", default-features = false, features = ["rt", "sync", "time", "macros", "net", "rt-multi-thread"] }
|
||||||
tokio-stream = "0.1"
|
tokio-stream = "0.1"
|
||||||
tower = "0.4"
|
tower = "0.4"
|
||||||
tower-http = { version = "0.5", default-features = false, features = ["cors", "fs"] }
|
tower-http = { version = "0.5", default-features = false, features = ["cors", "fs", "trace"] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-subscriber = { version = "0.3", default-features = false }
|
tracing-subscriber = { version = "0.3", default-features = false }
|
||||||
urlencoding = "2.1"
|
urlencoding = "2.1"
|
||||||
|
|
@ -152,7 +145,7 @@ uuid = { version = "1.11", default-features = false, features = ["v4"] }
|
||||||
# === TLS/SECURITY DEPENDENCIES ===
|
# === TLS/SECURITY DEPENDENCIES ===
|
||||||
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
|
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
|
||||||
tokio-rustls = "0.26"
|
tokio-rustls = "0.26"
|
||||||
rcgen = { version = "0.14", default-features = false }
|
rcgen = { version = "0.14", default-features = false, features = ["crypto", "ring"] } # Added ring feature
|
||||||
x509-parser = "0.15"
|
x509-parser = "0.15"
|
||||||
rustls-native-certs = "0.8"
|
rustls-native-certs = "0.8"
|
||||||
webpki-roots = "0.25"
|
webpki-roots = "0.25"
|
||||||
|
|
@ -164,7 +157,7 @@ tower-cookies = "0.10"
|
||||||
|
|
||||||
# === APP-SPECIFIC DEPENDENCIES ===
|
# === APP-SPECIFIC DEPENDENCIES ===
|
||||||
|
|
||||||
# Email Integration (mail feature)
|
# mail Integration (mail feature)
|
||||||
imap = { version = "3.0.0-alpha.15", optional = true }
|
imap = { version = "3.0.0-alpha.15", optional = true }
|
||||||
lettre = { version = "0.11", default-features = false, optional = true }
|
lettre = { version = "0.11", default-features = false, optional = true }
|
||||||
mailparse = { version = "0.15", optional = true }
|
mailparse = { version = "0.15", optional = true }
|
||||||
|
|
@ -176,29 +169,25 @@ livekit = { version = "0.7", optional = true }
|
||||||
# Vector Database (vectordb feature)
|
# Vector Database (vectordb feature)
|
||||||
qdrant-client = { version = "1.12", optional = true }
|
qdrant-client = { version = "1.12", optional = true }
|
||||||
|
|
||||||
# Document Processing - PICK ONE PER FORMAT!
|
# Document Processing
|
||||||
docx-rs = { version = "0.4", optional = true }
|
docx-rs = { version = "0.4", optional = true }
|
||||||
ooxmlsdk = { version = "0.3", default-features = false, optional = true }
|
ooxmlsdk = { version = "0.3", default-features = false, optional = true }
|
||||||
# umya-spreadsheet = { version = "2.3", optional = true } # REMOVE - pick one
|
|
||||||
calamine = { version = "0.26", optional = true }
|
calamine = { version = "0.26", optional = true }
|
||||||
# rust_xlsxwriter = { version = "0.79", optional = true } # REMOVE - pick one
|
|
||||||
spreadsheet-ods = { version = "1.0", optional = true }
|
spreadsheet-ods = { version = "1.0", optional = true }
|
||||||
|
|
||||||
# File Storage & Drive (drive feature)
|
# File Storage & Drive (drive feature)
|
||||||
aws-config = { version = "1.8.8", default-features = false, optional = true }
|
aws-config = { version = "1.8.8", default-features = false, optional = true }
|
||||||
aws-sdk-s3 = { version = "1.109.0", default-features = false, optional = true }
|
aws-sdk-s3 = { version = "1.109.0", default-features = false, optional = true }
|
||||||
pdf-extract = { version = "0.10.0", optional = true }
|
pdf-extract = { version = "0.10.0", optional = true }
|
||||||
quick-xml = { version = "0.37", default-features = false }
|
quick-xml = { version = "0.37", optional=true, default-features = false }
|
||||||
# zip = { version = "2.2", optional = true } # Only if needed
|
flate2 = { version = "1.0", optional = false }
|
||||||
# downloader = { version = "0.2", optional = true } # Use reqwest instead
|
zip = { version = "2.2", optional = false }
|
||||||
flate2 = { version = "1.0", optional = true }
|
tar = { version = "0.4", optional = false }
|
||||||
# tar = { version = "0.4", optional = true } # Only if needed
|
|
||||||
|
|
||||||
# Task Management (tasks feature)
|
# Task Management (tasks feature)
|
||||||
cron = { version = "0.15.0", optional = true }
|
cron = { version = "0.15.0", optional = true }
|
||||||
|
|
||||||
# Automation & Scripting (automation feature)
|
# Automation & Scripting (automation feature)
|
||||||
# REPLACE git with version
|
|
||||||
rhai = { version = "1.23", features = ["sync"], optional = true }
|
rhai = { version = "1.23", features = ["sync"], optional = true }
|
||||||
|
|
||||||
# Compliance & Reporting (compliance feature)
|
# Compliance & Reporting (compliance feature)
|
||||||
|
|
@ -222,7 +211,7 @@ redis = { version = "0.27", default-features = false, features = ["tokio-comp"],
|
||||||
sysinfo = { version = "0.37.2", optional = true }
|
sysinfo = { version = "0.37.2", optional = true }
|
||||||
|
|
||||||
# Networking/gRPC (grpc feature)
|
# Networking/gRPC (grpc feature)
|
||||||
tonic = { version = "0.14.2", default-features = false, features = ["transport", "tls"], optional = true }
|
tonic = { version = "0.14.2", default-features = false, features = ["transport"], optional = true }
|
||||||
|
|
||||||
# UI Enhancement (progress-bars feature)
|
# UI Enhancement (progress-bars feature)
|
||||||
indicatif = { version = "0.18.0", optional = true }
|
indicatif = { version = "0.18.0", optional = true }
|
||||||
|
|
@ -263,7 +252,7 @@ mockito = "1.7.0"
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
opt-level = 1 # Slightly optimized debug builds
|
opt-level = 1
|
||||||
split-debuginfo = "unpacked"
|
split-debuginfo = "unpacked"
|
||||||
incremental = true
|
incremental = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ async fn execute_create_draft(
|
||||||
subject: &str,
|
subject: &str,
|
||||||
reply_text: &str,
|
reply_text: &str,
|
||||||
) -> Result<String, String> {
|
) -> Result<String, String> {
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
use crate::email::{fetch_latest_sent_to, save_email_draft, SaveDraftRequest};
|
use crate::email::{fetch_latest_sent_to, save_email_draft, SaveDraftRequest};
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ async fn execute_create_draft(
|
||||||
.map(|()| "Draft saved successfully".to_string())
|
.map(|()| "Draft saved successfully".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "email"))]
|
#[cfg(not(feature = "mail"))]
|
||||||
{
|
{
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ async fn execute_send_mail(
|
||||||
return send_via_connected_account(state, &creds, to, subject, body, attachments).await;
|
return send_via_connected_account(state, &creds, to, subject, body, attachments).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
use crate::email::EmailService;
|
use crate::email::EmailService;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ fn send_email(
|
||||||
email: &str,
|
email: &str,
|
||||||
message: &str,
|
message: &str,
|
||||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
use crate::email::EmailService;
|
use crate::email::EmailService;
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ fn send_email(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "email"))]
|
#[cfg(not(feature = "mail"))]
|
||||||
{
|
{
|
||||||
let _ = (state, email, message);
|
let _ = (state, email, message);
|
||||||
error!("Email feature not enabled");
|
error!("Email feature not enabled");
|
||||||
|
|
@ -639,7 +639,7 @@ fn send_email_attachment(
|
||||||
file_data: Vec<u8>,
|
file_data: Vec<u8>,
|
||||||
caption: &str,
|
caption: &str,
|
||||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
use crate::email::EmailService;
|
use crate::email::EmailService;
|
||||||
|
|
||||||
|
|
@ -654,7 +654,7 @@ fn send_email_attachment(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "email"))]
|
#[cfg(not(feature = "mail"))]
|
||||||
{
|
{
|
||||||
let _ = (state, email, file_data, caption);
|
let _ = (state, email, file_data, caption);
|
||||||
error!("Email feature not enabled for attachments");
|
error!("Email feature not enabled for attachments");
|
||||||
|
|
|
||||||
|
|
@ -181,55 +181,101 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
user_email_accounts (id) {
|
rbac_roles (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
user_id -> Uuid,
|
name -> Varchar,
|
||||||
email -> Varchar,
|
display_name -> Varchar,
|
||||||
display_name -> Nullable<Varchar>,
|
description -> Nullable<Text>,
|
||||||
imap_server -> Varchar,
|
is_system -> Bool,
|
||||||
imap_port -> Int4,
|
|
||||||
smtp_server -> Varchar,
|
|
||||||
smtp_port -> Int4,
|
|
||||||
username -> Varchar,
|
|
||||||
password_encrypted -> Text,
|
|
||||||
is_primary -> Bool,
|
|
||||||
is_active -> Bool,
|
is_active -> Bool,
|
||||||
|
created_by -> Nullable<Uuid>,
|
||||||
created_at -> Timestamptz,
|
created_at -> Timestamptz,
|
||||||
updated_at -> Timestamptz,
|
updated_at -> Timestamptz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
email_drafts (id) {
|
rbac_groups (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
name -> Varchar,
|
||||||
|
display_name -> Varchar,
|
||||||
|
description -> Nullable<Text>,
|
||||||
|
parent_group_id -> Nullable<Uuid>,
|
||||||
|
is_active -> Bool,
|
||||||
|
created_by -> Nullable<Uuid>,
|
||||||
|
created_at -> Timestamptz,
|
||||||
|
updated_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
rbac_permissions (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
name -> Varchar,
|
||||||
|
display_name -> Varchar,
|
||||||
|
description -> Nullable<Text>,
|
||||||
|
resource_type -> Varchar,
|
||||||
|
action -> Varchar,
|
||||||
|
category -> Varchar,
|
||||||
|
is_system -> Bool,
|
||||||
|
created_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
rbac_role_permissions (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
role_id -> Uuid,
|
||||||
|
permission_id -> Uuid,
|
||||||
|
granted_by -> Nullable<Uuid>,
|
||||||
|
granted_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
rbac_user_roles (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
user_id -> Uuid,
|
user_id -> Uuid,
|
||||||
account_id -> Uuid,
|
role_id -> Uuid,
|
||||||
to_address -> Text,
|
granted_by -> Nullable<Uuid>,
|
||||||
cc_address -> Nullable<Text>,
|
granted_at -> Timestamptz,
|
||||||
bcc_address -> Nullable<Text>,
|
expires_at -> Nullable<Timestamptz>,
|
||||||
subject -> Nullable<Varchar>,
|
|
||||||
body -> Nullable<Text>,
|
|
||||||
attachments -> Jsonb,
|
|
||||||
created_at -> Timestamptz,
|
|
||||||
updated_at -> Timestamptz,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
email_folders (id) {
|
rbac_user_groups (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
account_id -> Uuid,
|
user_id -> Uuid,
|
||||||
folder_name -> Varchar,
|
group_id -> Uuid,
|
||||||
folder_path -> Varchar,
|
added_by -> Nullable<Uuid>,
|
||||||
unread_count -> Int4,
|
added_at -> Timestamptz,
|
||||||
total_count -> Int4,
|
|
||||||
last_synced -> Nullable<Timestamptz>,
|
|
||||||
created_at -> Timestamptz,
|
|
||||||
updated_at -> Timestamptz,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
rbac_group_roles (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
group_id -> Uuid,
|
||||||
|
role_id -> Uuid,
|
||||||
|
granted_by -> Nullable<Uuid>,
|
||||||
|
granted_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::joinable!(rbac_role_permissions -> rbac_roles (role_id));
|
||||||
|
diesel::joinable!(rbac_role_permissions -> rbac_permissions (permission_id));
|
||||||
|
diesel::joinable!(rbac_user_roles -> users (user_id));
|
||||||
|
diesel::joinable!(rbac_user_roles -> rbac_roles (role_id));
|
||||||
|
diesel::joinable!(rbac_user_groups -> users (user_id));
|
||||||
|
diesel::joinable!(rbac_user_groups -> rbac_groups (group_id));
|
||||||
|
diesel::joinable!(rbac_group_roles -> rbac_groups (group_id));
|
||||||
|
diesel::joinable!(rbac_group_roles -> rbac_roles (role_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
user_preferences (id) {
|
user_preferences (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
|
|
@ -293,6 +339,57 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
user_email_accounts (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
user_id -> Uuid,
|
||||||
|
email -> Varchar,
|
||||||
|
display_name -> Nullable<Varchar>,
|
||||||
|
imap_server -> Varchar,
|
||||||
|
imap_port -> Int4,
|
||||||
|
smtp_server -> Varchar,
|
||||||
|
smtp_port -> Int4,
|
||||||
|
username -> Varchar,
|
||||||
|
password_encrypted -> Text,
|
||||||
|
is_primary -> Bool,
|
||||||
|
is_active -> Bool,
|
||||||
|
created_at -> Timestamptz,
|
||||||
|
updated_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
email_drafts (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
user_id -> Uuid,
|
||||||
|
account_id -> Uuid,
|
||||||
|
to_address -> Text,
|
||||||
|
cc_address -> Nullable<Text>,
|
||||||
|
bcc_address -> Nullable<Text>,
|
||||||
|
subject -> Nullable<Varchar>,
|
||||||
|
body -> Nullable<Text>,
|
||||||
|
attachments -> Jsonb,
|
||||||
|
created_at -> Timestamptz,
|
||||||
|
updated_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diesel::table! {
|
||||||
|
email_folders (id) {
|
||||||
|
id -> Uuid,
|
||||||
|
account_id -> Uuid,
|
||||||
|
folder_name -> Varchar,
|
||||||
|
folder_path -> Varchar,
|
||||||
|
unread_count -> Int4,
|
||||||
|
total_count -> Int4,
|
||||||
|
last_synced -> Nullable<Timestamptz>,
|
||||||
|
created_at -> Timestamptz,
|
||||||
|
updated_at -> Timestamptz,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
email_signatures (id) {
|
email_signatures (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
|
|
@ -447,98 +544,6 @@ diesel::table! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_roles (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
name -> Varchar,
|
|
||||||
display_name -> Varchar,
|
|
||||||
description -> Nullable<Text>,
|
|
||||||
is_system -> Bool,
|
|
||||||
is_active -> Bool,
|
|
||||||
created_by -> Nullable<Uuid>,
|
|
||||||
created_at -> Timestamptz,
|
|
||||||
updated_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_groups (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
name -> Varchar,
|
|
||||||
display_name -> Varchar,
|
|
||||||
description -> Nullable<Text>,
|
|
||||||
parent_group_id -> Nullable<Uuid>,
|
|
||||||
is_active -> Bool,
|
|
||||||
created_by -> Nullable<Uuid>,
|
|
||||||
created_at -> Timestamptz,
|
|
||||||
updated_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_permissions (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
name -> Varchar,
|
|
||||||
display_name -> Varchar,
|
|
||||||
description -> Nullable<Text>,
|
|
||||||
resource_type -> Varchar,
|
|
||||||
action -> Varchar,
|
|
||||||
category -> Varchar,
|
|
||||||
is_system -> Bool,
|
|
||||||
created_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_role_permissions (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
role_id -> Uuid,
|
|
||||||
permission_id -> Uuid,
|
|
||||||
granted_by -> Nullable<Uuid>,
|
|
||||||
granted_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_user_roles (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
user_id -> Uuid,
|
|
||||||
role_id -> Uuid,
|
|
||||||
granted_by -> Nullable<Uuid>,
|
|
||||||
granted_at -> Timestamptz,
|
|
||||||
expires_at -> Nullable<Timestamptz>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_user_groups (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
user_id -> Uuid,
|
|
||||||
group_id -> Uuid,
|
|
||||||
added_by -> Nullable<Uuid>,
|
|
||||||
added_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::table! {
|
|
||||||
rbac_group_roles (id) {
|
|
||||||
id -> Uuid,
|
|
||||||
group_id -> Uuid,
|
|
||||||
role_id -> Uuid,
|
|
||||||
granted_by -> Nullable<Uuid>,
|
|
||||||
granted_at -> Timestamptz,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diesel::joinable!(rbac_role_permissions -> rbac_roles (role_id));
|
|
||||||
diesel::joinable!(rbac_role_permissions -> rbac_permissions (permission_id));
|
|
||||||
diesel::joinable!(rbac_user_roles -> users (user_id));
|
|
||||||
diesel::joinable!(rbac_user_roles -> rbac_roles (role_id));
|
|
||||||
diesel::joinable!(rbac_user_groups -> users (user_id));
|
|
||||||
diesel::joinable!(rbac_user_groups -> rbac_groups (group_id));
|
|
||||||
diesel::joinable!(rbac_group_roles -> rbac_groups (group_id));
|
|
||||||
diesel::joinable!(rbac_group_roles -> rbac_roles (role_id));
|
|
||||||
|
|
||||||
diesel::table! {
|
diesel::table! {
|
||||||
crm_contacts (id) {
|
crm_contacts (id) {
|
||||||
id -> Uuid,
|
id -> Uuid,
|
||||||
|
|
@ -983,59 +988,61 @@ diesel::table! {
|
||||||
barcode -> Nullable<Varchar>,
|
barcode -> Nullable<Varchar>,
|
||||||
created_at -> Timestamptz,
|
created_at -> Timestamptz,
|
||||||
updated_at -> Timestamptz,
|
updated_at -> Timestamptz,
|
||||||
// Tax and fiscal identification
|
// // Tax and fiscal identification
|
||||||
tax_code -> Nullable<Varchar>,
|
// tax_code -> Nullable<Varchar>,
|
||||||
tax_class -> Nullable<Varchar>,
|
// tax_class -> Nullable<Varchar>,
|
||||||
fiscal_code -> Nullable<Varchar>,
|
// fiscal_code -> Nullable<Varchar>,
|
||||||
origin_code -> Nullable<Int4>,
|
// origin_code -> Nullable<Int4>,
|
||||||
global_trade_number -> Nullable<Varchar>,
|
// global_trade_number -> Nullable<Varchar>,
|
||||||
tax_unit_code -> Nullable<Varchar>,
|
// tax_unit_code -> Nullable<Varchar>,
|
||||||
// Detailed dimensions (shipping)
|
|
||||||
net_weight -> Nullable<Numeric>,
|
|
||||||
gross_weight -> Nullable<Numeric>,
|
// // Detailed dimensions (shipping)
|
||||||
width -> Nullable<Numeric>,
|
// net_weight -> Nullable<Numeric>,
|
||||||
height -> Nullable<Numeric>,
|
// gross_weight -> Nullable<Numeric>,
|
||||||
length -> Nullable<Numeric>,
|
// width -> Nullable<Numeric>,
|
||||||
package_count -> Nullable<Int4>,
|
// height -> Nullable<Numeric>,
|
||||||
// Tax rates by type
|
// length -> Nullable<Numeric>,
|
||||||
sales_tax_code -> Nullable<Varchar>,
|
// package_count -> Nullable<Int4>,
|
||||||
sales_tax_rate -> Nullable<Numeric>,
|
// // Tax rates by type
|
||||||
excise_tax_code -> Nullable<Varchar>,
|
// sales_tax_code -> Nullable<Varchar>,
|
||||||
excise_tax_rate -> Nullable<Numeric>,
|
// sales_tax_rate -> Nullable<Numeric>,
|
||||||
vat_code -> Nullable<Varchar>,
|
// excise_tax_code -> Nullable<Varchar>,
|
||||||
vat_rate -> Nullable<Numeric>,
|
// excise_tax_rate -> Nullable<Numeric>,
|
||||||
service_tax_code -> Nullable<Varchar>,
|
// vat_code -> Nullable<Varchar>,
|
||||||
service_tax_rate -> Nullable<Numeric>,
|
// vat_rate -> Nullable<Numeric>,
|
||||||
// Marketplace and e-commerce
|
// service_tax_code -> Nullable<Varchar>,
|
||||||
brand -> Nullable<Varchar>,
|
// service_tax_rate -> Nullable<Numeric>,
|
||||||
model -> Nullable<Varchar>,
|
// // Marketplace and e-commerce
|
||||||
color -> Nullable<Varchar>,
|
// brand -> Nullable<Varchar>,
|
||||||
size -> Nullable<Varchar>,
|
// model -> Nullable<Varchar>,
|
||||||
material -> Nullable<Varchar>,
|
// color -> Nullable<Varchar>,
|
||||||
gender -> Nullable<Varchar>,
|
// size -> Nullable<Varchar>,
|
||||||
// Advanced inventory control
|
// material -> Nullable<Varchar>,
|
||||||
warehouse_location -> Nullable<Varchar>,
|
// gender -> Nullable<Varchar>,
|
||||||
batch_number -> Nullable<Varchar>,
|
// // Advanced inventory control
|
||||||
expiration_date -> Nullable<Date>,
|
// warehouse_location -> Nullable<Varchar>,
|
||||||
manufacture_date -> Nullable<Date>,
|
// batch_number -> Nullable<Varchar>,
|
||||||
min_stock -> Nullable<Int4>,
|
// expiration_date -> Nullable<Date>,
|
||||||
max_stock -> Nullable<Int4>,
|
// manufacture_date -> Nullable<Date>,
|
||||||
reorder_point -> Nullable<Int4>,
|
// min_stock -> Nullable<Int4>,
|
||||||
// Detailed pricing
|
// max_stock -> Nullable<Int4>,
|
||||||
sale_price -> Nullable<Numeric>,
|
// reorder_point -> Nullable<Int4>,
|
||||||
sale_start -> Nullable<Timestamptz>,
|
// // Detailed pricing
|
||||||
sale_end -> Nullable<Timestamptz>,
|
// sale_price -> Nullable<Numeric>,
|
||||||
shipping_cost -> Nullable<Numeric>,
|
// sale_start -> Nullable<Timestamptz>,
|
||||||
profit_margin -> Nullable<Numeric>,
|
// sale_end -> Nullable<Timestamptz>,
|
||||||
|
// shipping_cost -> Nullable<Numeric>,
|
||||||
|
// profit_margin -> Nullable<Numeric>,
|
||||||
// Payment gateway integration
|
// Payment gateway integration
|
||||||
external_id -> Nullable<Varchar>,
|
// external_id -> Nullable<Varchar>,
|
||||||
external_category_id -> Nullable<Varchar>,
|
// external_category_id -> Nullable<Varchar>,
|
||||||
external_metadata -> Nullable<Jsonb>,
|
// external_metadata -> Nullable<Jsonb>,
|
||||||
// SEO and search
|
// // SEO and search
|
||||||
slug -> Nullable<Varchar>,
|
// slug -> Nullable<Varchar>,
|
||||||
meta_title -> Nullable<Varchar>,
|
// meta_title -> Nullable<Varchar>,
|
||||||
meta_description -> Nullable<Text>,
|
// meta_description -> Nullable<Text>,
|
||||||
tags -> Nullable<Array<Nullable<Text>>>,
|
// tags -> Nullable<Array<Nullable<Text>>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ pub mod directory;
|
||||||
#[cfg(feature = "drive")]
|
#[cfg(feature = "drive")]
|
||||||
pub mod drive;
|
pub mod drive;
|
||||||
|
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
pub mod email;
|
pub mod email;
|
||||||
|
|
||||||
#[cfg(feature = "instagram")]
|
#[cfg(feature = "instagram")]
|
||||||
|
|
@ -427,7 +427,7 @@ async fn run_axum_server(
|
||||||
api_router = api_router.merge(crate::meet::configure());
|
api_router = api_router.merge(crate::meet::configure());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
api_router = api_router.merge(crate::email::configure());
|
api_router = api_router.merge(crate::email::configure());
|
||||||
}
|
}
|
||||||
|
|
@ -503,7 +503,7 @@ api_router = api_router.merge(crate::video::configure_video_routes());
|
||||||
api_router = api_router.merge(crate::social::configure_social_routes());
|
api_router = api_router.merge(crate::social::configure_social_routes());
|
||||||
api_router = api_router.merge(crate::social::ui::configure_social_ui_routes());
|
api_router = api_router.merge(crate::social::ui::configure_social_ui_routes());
|
||||||
api_router = api_router.merge(crate::learn::ui::configure_learn_ui_routes());
|
api_router = api_router.merge(crate::learn::ui::configure_learn_ui_routes());
|
||||||
#[cfg(feature = "email")]
|
#[cfg(feature = "mail")]
|
||||||
{
|
{
|
||||||
api_router = api_router.merge(crate::email::ui::configure_email_ui_routes());
|
api_router = api_router.merge(crate::email::ui::configure_email_ui_routes());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,59 +48,59 @@ pub struct Product {
|
||||||
pub barcode: Option<String>,
|
pub barcode: Option<String>,
|
||||||
pub created_at: DateTime<Utc>,
|
pub created_at: DateTime<Utc>,
|
||||||
pub updated_at: DateTime<Utc>,
|
pub updated_at: DateTime<Utc>,
|
||||||
// Tax and fiscal identification
|
// // Tax and fiscal identification
|
||||||
pub tax_code: Option<String>,
|
// pub tax_code: Option<String>,
|
||||||
pub tax_class: Option<String>,
|
// pub tax_class: Option<String>,
|
||||||
pub fiscal_code: Option<String>,
|
// pub fiscal_code: Option<String>,
|
||||||
pub origin_code: Option<i32>,
|
// pub origin_code: Option<i32>,
|
||||||
pub global_trade_number: Option<String>,
|
// pub global_trade_number: Option<String>,
|
||||||
pub tax_unit_code: Option<String>,
|
// pub tax_unit_code: Option<String>,
|
||||||
// Detailed dimensions (shipping)
|
// // Detailed dimensions (shipping)
|
||||||
pub net_weight: Option<BigDecimal>,
|
// pub net_weight: Option<BigDecimal>,
|
||||||
pub gross_weight: Option<BigDecimal>,
|
// pub gross_weight: Option<BigDecimal>,
|
||||||
pub width: Option<BigDecimal>,
|
// pub width: Option<BigDecimal>,
|
||||||
pub height: Option<BigDecimal>,
|
// pub height: Option<BigDecimal>,
|
||||||
pub length: Option<BigDecimal>,
|
// pub length: Option<BigDecimal>,
|
||||||
pub package_count: Option<i32>,
|
// pub package_count: Option<i32>,
|
||||||
// Tax rates by type
|
// // Tax rates by type
|
||||||
pub sales_tax_code: Option<String>,
|
// pub sales_tax_code: Option<String>,
|
||||||
pub sales_tax_rate: Option<BigDecimal>,
|
// pub sales_tax_rate: Option<BigDecimal>,
|
||||||
pub excise_tax_code: Option<String>,
|
// pub excise_tax_code: Option<String>,
|
||||||
pub excise_tax_rate: Option<BigDecimal>,
|
// pub excise_tax_rate: Option<BigDecimal>,
|
||||||
pub vat_code: Option<String>,
|
// pub vat_code: Option<String>,
|
||||||
pub vat_rate: Option<BigDecimal>,
|
// pub vat_rate: Option<BigDecimal>,
|
||||||
pub service_tax_code: Option<String>,
|
// pub service_tax_code: Option<String>,
|
||||||
pub service_tax_rate: Option<BigDecimal>,
|
// pub service_tax_rate: Option<BigDecimal>,
|
||||||
// Marketplace and e-commerce
|
// // Marketplace and e-commerce
|
||||||
pub brand: Option<String>,
|
// pub brand: Option<String>,
|
||||||
pub model: Option<String>,
|
// pub model: Option<String>,
|
||||||
pub color: Option<String>,
|
// pub color: Option<String>,
|
||||||
pub size: Option<String>,
|
// pub size: Option<String>,
|
||||||
pub material: Option<String>,
|
// pub material: Option<String>,
|
||||||
pub gender: Option<String>,
|
// pub gender: Option<String>,
|
||||||
// Advanced inventory control
|
// // Advanced inventory control
|
||||||
pub warehouse_location: Option<String>,
|
// pub warehouse_location: Option<String>,
|
||||||
pub batch_number: Option<String>,
|
// pub batch_number: Option<String>,
|
||||||
pub expiration_date: Option<chrono::NaiveDate>,
|
// pub expiration_date: Option<chrono::NaiveDate>,
|
||||||
pub manufacture_date: Option<chrono::NaiveDate>,
|
// pub manufacture_date: Option<chrono::NaiveDate>,
|
||||||
pub min_stock: Option<i32>,
|
// pub min_stock: Option<i32>,
|
||||||
pub max_stock: Option<i32>,
|
// pub max_stock: Option<i32>,
|
||||||
pub reorder_point: Option<i32>,
|
// pub reorder_point: Option<i32>,
|
||||||
// Detailed pricing
|
// // Detailed pricing
|
||||||
pub sale_price: Option<BigDecimal>,
|
// pub sale_price: Option<BigDecimal>,
|
||||||
pub sale_start: Option<DateTime<Utc>>,
|
// pub sale_start: Option<DateTime<Utc>>,
|
||||||
pub sale_end: Option<DateTime<Utc>>,
|
// pub sale_end: Option<DateTime<Utc>>,
|
||||||
pub shipping_cost: Option<BigDecimal>,
|
// pub shipping_cost: Option<BigDecimal>,
|
||||||
pub profit_margin: Option<BigDecimal>,
|
// pub profit_margin: Option<BigDecimal>,
|
||||||
// Payment gateway integration
|
// Payment gateway integration
|
||||||
pub external_id: Option<String>,
|
// pub external_id: Option<String>,
|
||||||
pub external_category_id: Option<String>,
|
// pub external_category_id: Option<String>,
|
||||||
pub external_metadata: Option<serde_json::Value>,
|
// pub external_metadata: Option<serde_json::Value>,
|
||||||
// SEO and search
|
// // SEO and search
|
||||||
pub slug: Option<String>,
|
// pub slug: Option<String>,
|
||||||
pub meta_title: Option<String>,
|
// pub meta_title: Option<String>,
|
||||||
pub meta_description: Option<String>,
|
// pub meta_description: Option<String>,
|
||||||
pub tags: Option<Vec<Option<String>>>,
|
// pub tags: Option<Vec<Option<String>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Queryable, Insertable, AsChangeset)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Queryable, Insertable, AsChangeset)]
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ use uuid::Uuid;
|
||||||
use crate::drive::vectordb::UserDriveVectorDB;
|
use crate::drive::vectordb::UserDriveVectorDB;
|
||||||
#[cfg(feature = "vectordb")]
|
#[cfg(feature = "vectordb")]
|
||||||
use crate::drive::vectordb::{FileContentExtractor, FileDocument};
|
use crate::drive::vectordb::{FileContentExtractor, FileDocument};
|
||||||
#[cfg(all(feature = "vectordb", feature = "email"))]
|
#[cfg(all(feature = "vectordb", feature = "mail"))]
|
||||||
use crate::email::vectordb::UserEmailVectorDB;
|
use crate::email::vectordb::UserEmailVectorDB;
|
||||||
#[cfg(all(feature = "vectordb", feature = "email"))]
|
#[cfg(all(feature = "vectordb", feature = "mail"))]
|
||||||
use crate::email::vectordb::{EmailDocument, EmailEmbeddingGenerator};
|
use crate::email::vectordb::{EmailDocument, EmailEmbeddingGenerator};
|
||||||
use crate::shared::utils::DbPool;
|
use crate::shared::utils::DbPool;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ struct UserIndexingJob {
|
||||||
user_id: Uuid,
|
user_id: Uuid,
|
||||||
bot_id: Uuid,
|
bot_id: Uuid,
|
||||||
workspace: UserWorkspace,
|
workspace: UserWorkspace,
|
||||||
#[cfg(all(feature = "vectordb", feature = "email"))]
|
#[cfg(all(feature = "vectordb", feature = "mail"))]
|
||||||
email_db: Option<UserEmailVectorDB>,
|
email_db: Option<UserEmailVectorDB>,
|
||||||
#[cfg(feature = "vectordb")]
|
#[cfg(feature = "vectordb")]
|
||||||
drive_db: Option<UserDriveVectorDB>,
|
drive_db: Option<UserDriveVectorDB>,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue