template-saas/apps/database/ddl/schemas/ai/_MAP.md
rckrdmrd 40d57f8124 feat: Add AI Integration, Notifications UI and Settings Page
FASE 1: Notifications UI
- Add NotificationBell, NotificationDrawer, NotificationItem components
- Integrate notification bell in DashboardLayout header
- Real-time unread count with polling

FASE 2: AI Integration Backend
- Add AI module with OpenRouter client
- Endpoints: POST /ai/chat, GET /ai/models, GET/PATCH /ai/config
- GET /ai/usage, GET /ai/usage/current, GET /ai/health
- Database: schema ai with configs and usage tables
- Token tracking and cost calculation

FASE 3: Settings Page Refactor
- Restructure with tabs navigation
- GeneralSettings: profile, organization, appearance
- NotificationSettings: channels and categories toggles
- SecuritySettings: password change, 2FA placeholder, sessions

Files created: 25+
Endpoints added: 7
Story Points completed: 21

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 07:04:29 -06:00

735 B

Schema: ai

AI Integration - Configuraciones, tracking de uso y rate limits.

Tablas

Archivo Tabla Descripcion
01-ai-configs.sql ai.configs Configuracion AI por tenant
02-ai-usage.sql ai.usage Tracking de uso de API calls

Enums (en 02-enums.sql)

  • ai.ai_provider - openrouter, openai, anthropic, google
  • ai.ai_model_type - chat, completion, embedding, image
  • ai.usage_status - pending, completed, failed, cancelled

Vistas

  • ai.monthly_usage - Resumen mensual de uso por tenant

Funciones

  • ai.get_current_month_usage(tenant_id) - Uso del mes actual

RLS Policies

Ambas tablas tienen Row Level Security habilitado con aislamiento por tenant.