Files
lagos-back/src/routes/index.ts
T
Mustafa YildizandClaude Sonnet 5 5fe4b0b8bc feat: WhatsApp AI hattı (n8n + Evolution API) için yeni uç nokta
chat.controller.ts'teki dosya-bağlamı toplama mantığı (belgeler + analiz
özeti + geçmiş mesajlar) buildCaseChatContext() olarak paylaşılan hale
getirildi — mevcut SSE sohbeti (chatMessage) davranış değişmeden bunu
kullanıyor, yeni POST /api/whatsapp/message uç noktası da aynı motoru
tek-seferlik (non-streaming) çağırıyor.

Kimlik doğrulama farklı: bu uç nokta bir Supabase oturumu taşımıyor
(n8n'den gelen anonim WhatsApp mesajı), X-Webhook-Secret ile korunuyor.
Telefon → hesap eşleştirmesi profiles.phone üzerinden, hangi dava
dosyasıyla konuşulduğu whatsapp_sessions'ta tutuluyor (bkz. laawos
sql/20_whatsapp_integration.sql).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 13:08:02 +03:00

29 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Router } from 'express';
import documentRoutes from './document.routes';
import chatRoutes from './chat.routes';
import precedentRoutes from './precedent.routes';
import caseRoutes from './case.routes';
import templateRoutes from './template.routes';
import draftingRoutes from './drafting.routes';
import googleDriveRoutes from './googleDrive.routes';
import authRoutes from './auth.routes';
import whatsappRoutes from './whatsapp.routes';
const router = Router();
router.get('/health', (req, res) => {
res.json({ status: 'ok', message: 'AyrisLegal Backend is running' });
});
router.use('/auth', authRoutes); // POST /api/auth/register, /api/auth/check-device
router.use('/documents', documentRoutes);
router.use('/chat', chatRoutes);
router.use('/cases', caseRoutes);
router.use('/templates', templateRoutes);
router.use('/drafting', draftingRoutes);
router.use('/google-drive', googleDriveRoutes);
router.use('/whatsapp', whatsappRoutes); // POST /api/whatsapp/message (n8n webhook, ayrı X-Webhook-Secret doğrulaması)
router.use('/', precedentRoutes); // Keeps the same paths like /api/search-precedents
export default router;