Add organizations table and build fix script
Create organizations table with UUID primary key, unique slug, timestamps, and indexes on slug and created_at. Add scripts/dev/build_fix.sh to consolidate prompts and source files for LLM context. Allow dead_code in main.rs and rename unused org_id parameter to _org_id.
This commit is contained in:
parent
8a9cd104d6
commit
a8c2a5ba25
4 changed files with 72 additions and 1 deletions
|
|
@ -1,4 +1,16 @@
|
||||||
-- Optimized database schema
|
-- Optimized database schema
|
||||||
|
-- Add organizations table
|
||||||
|
CREATE TABLE IF NOT EXISTS organizations (
|
||||||
|
org_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
slug VARCHAR(255) UNIQUE NOT NULL,
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Create indexes for better performance
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_organizations_slug ON organizations(slug);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_organizations_created_at ON organizations(created_at);
|
||||||
|
|
||||||
-- Core tables
|
-- Core tables
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
|
|
|
||||||
57
scripts/dev/build_fix.sh
Executable file
57
scripts/dev/build_fix.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||||
|
OUTPUT_FILE="$SCRIPT_DIR/prompt.txt"
|
||||||
|
|
||||||
|
echo "Consolidated LLM Context" > "$OUTPUT_FILE"
|
||||||
|
|
||||||
|
prompts=(
|
||||||
|
"../../prompts/dev/general.md"
|
||||||
|
"../../Cargo.toml"
|
||||||
|
"../../prompts/dev/fix.md"
|
||||||
|
)
|
||||||
|
|
||||||
|
for file in "${prompts[@]}"; do
|
||||||
|
cat "$file" >> "$OUTPUT_FILE"
|
||||||
|
echo "" >> "$OUTPUT_FILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
dirs=(
|
||||||
|
"auth"
|
||||||
|
"automation"
|
||||||
|
"basic"
|
||||||
|
"bot"
|
||||||
|
"channels"
|
||||||
|
"chart"
|
||||||
|
"config"
|
||||||
|
"context"
|
||||||
|
"email"
|
||||||
|
"file"
|
||||||
|
"llm"
|
||||||
|
"llm_legacy"
|
||||||
|
"org"
|
||||||
|
"session"
|
||||||
|
"shared"
|
||||||
|
"tests"
|
||||||
|
"tools"
|
||||||
|
"web_automation"
|
||||||
|
"whatsapp"
|
||||||
|
)
|
||||||
|
|
||||||
|
for dir in "${dirs[@]}"; do
|
||||||
|
find "$PROJECT_ROOT/src/$dir" -name "*.rs" | while read file; do
|
||||||
|
cat "$file" >> "$OUTPUT_FILE"
|
||||||
|
echo "" >> "$OUTPUT_FILE"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
cat "$PROJECT_ROOT/src/main.rs" >> "$OUTPUT_FILE"
|
||||||
|
echo "" >> "$OUTPUT_FILE"
|
||||||
|
|
||||||
|
|
||||||
|
cd "$PROJECT_ROOT"
|
||||||
|
tree -P '*.rs' -I 'target|*.lock' --prune | grep -v '[0-9] directories$' >> "$OUTPUT_FILE"
|
||||||
|
|
||||||
|
|
||||||
|
cargo build 2>> "$OUTPUT_FILE"
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use actix_cors::Cors;
|
use actix_cors::Cors;
|
||||||
use actix_web::middleware::Logger;
|
use actix_web::middleware::Logger;
|
||||||
use actix_web::{web, App, HttpServer};
|
use actix_web::{web, App, HttpServer};
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ impl OrganizationService {
|
||||||
|
|
||||||
pub async fn get_organization(
|
pub async fn get_organization(
|
||||||
&self,
|
&self,
|
||||||
org_id: Uuid,
|
_org_id: Uuid,
|
||||||
) -> Result<Option<Organization>, Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<Option<Organization>, Box<dyn std::error::Error + Send + Sync>> {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue