mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
Full-stack AI-powered sales automation platform for Saudi SMEs: Backend (FastAPI + PostgreSQL): - Multi-tenant architecture with row-level isolation - JWT auth with RBAC (owner/manager/agent/admin) - Lead, Customer, Deal, Pipeline, Activity, Message, Proposal models - Dashboard analytics API (overview, pipeline, revenue) - WhatsApp Business API, Email (SMTP/SendGrid), SMS (Unifonic) integrations - Celery + Redis workers for automated follow-ups and scheduled messages - Property model for Real Estate module (Riyadh districts) - Hijri date utilities, Arabic/English localization Frontend (Next.js + Tailwind): - Professional Arabic RTL landing page with 10 sections - Brand identity: SalesMatic (سيلزماتك) with custom SVG logo - Color system: Trust Blue #0F4C81, Growth Teal #00BFA6, CTA Orange #FF6B35 - IBM Plex Sans Arabic + Inter typography - Responsive design, dark hero section, pricing table, FAQ Industry Templates: - Healthcare/Clinics: pipeline stages, WhatsApp message templates, auto-workflows - Real Estate Riyadh: 20 districts, property tours, payment plans, matching Infrastructure: - Docker Compose (PostgreSQL, Redis, Backend, Celery, Frontend, Nginx) - Nginx reverse proxy config - Makefile for common operations https://claude.ai/code/session_01LLR7jzpyNRwDA9kojtT3CW
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from app.database import get_db
|
|
from app.api.deps import get_current_user, get_current_tenant, require_role
|
|
from app.models.user import User
|
|
from app.models.tenant import Tenant
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class TenantResponse(BaseModel):
|
|
id: UUID
|
|
name: str
|
|
name_ar: Optional[str]
|
|
slug: str
|
|
industry: Optional[str]
|
|
plan: str
|
|
logo_url: Optional[str]
|
|
phone: Optional[str]
|
|
email: Optional[str]
|
|
whatsapp_number: Optional[str]
|
|
settings: Optional[dict]
|
|
is_active: bool
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class TenantUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
name_ar: Optional[str] = None
|
|
phone: Optional[str] = None
|
|
email: Optional[str] = None
|
|
whatsapp_number: Optional[str] = None
|
|
industry: Optional[str] = None
|
|
settings: Optional[dict] = None
|
|
|
|
|
|
@router.get("", response_model=TenantResponse)
|
|
async def get_tenant(tenant: Tenant = Depends(get_current_tenant)):
|
|
return TenantResponse.model_validate(tenant)
|
|
|
|
|
|
@router.put("", response_model=TenantResponse)
|
|
async def update_tenant(
|
|
data: TenantUpdate,
|
|
tenant: Tenant = Depends(get_current_tenant),
|
|
current_user: User = Depends(require_role("owner", "admin")),
|
|
db: AsyncSession = Depends(get_db),
|
|
):
|
|
for field, value in data.model_dump(exclude_none=True).items():
|
|
setattr(tenant, field, value)
|
|
|
|
await db.flush()
|
|
await db.refresh(tenant)
|
|
return TenantResponse.model_validate(tenant)
|