Files
unai/src/app/api/domains/route.ts
T
Krikorios aa459f4bd6 🎉 Complete AI-Enhanced University Portal - Ready for Production
 Major Features Added:
- AI Chat with conversation memory and university-specific knowledge base
- Multi-tenant university support with white-label capabilities
- Professional admin interface for knowledge base management
- Advanced database schema with Prisma ORM
- Comprehensive documentation and guides
- Modern Next.js 15 + React 19 architecture
- Bilingual support (English/Arabic)
- Role-based access control
- Real-time chat interface with loading states

🔧 Technical Improvements:
- Fixed all linter errors and TypeScript issues
- Cleaned up codebase and removed legacy files
- Added comprehensive .gitignore
- Updated README with detailed setup instructions
- Optimized database schema and migrations
- Enhanced error handling and user experience

📚 Documentation:
- AI Conversation Memory Guide
- AI Enhancement Summary
- Developer Guide
- User Guide
- Complete setup and deployment instructions

🚀 Ready for GitHub deployment and production use!
2025-07-20 08:26:25 +04:00

65 lines
1.7 KiB
TypeScript

import { NextRequest, NextResponse } from 'next/server';
import { createDomainManager } from '@/lib/domainManagement';
export async function GET(request: NextRequest) {
try {
const universityId = request.headers.get('x-university-id');
if (!universityId) {
return NextResponse.json(
{ error: 'University context required' },
{ status: 400 }
);
}
const domainManager = createDomainManager(universityId);
const domains = await domainManager.getDomains();
return NextResponse.json({
success: true,
data: domains,
});
} catch (error) {
console.error('Error fetching domains:', error);
return NextResponse.json(
{ error: 'Failed to fetch domains' },
{ status: 500 }
);
}
}
export async function POST(request: NextRequest) {
try {
const universityId = request.headers.get('x-university-id');
if (!universityId) {
return NextResponse.json(
{ error: 'University context required' },
{ status: 400 }
);
}
const body = await request.json();
const { type, domain, subdomain } = body;
if (!type || !domain) {
return NextResponse.json(
{ error: 'Type and domain are required' },
{ status: 400 }
);
}
const domainManager = createDomainManager(universityId);
const newDomain = await domainManager.addDomain(type, domain, subdomain);
return NextResponse.json({
success: true,
data: newDomain,
message: 'Domain configuration created successfully',
});
} catch (error) {
console.error('Error creating domain:', error);
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Failed to create domain' },
{ status: 500 }
);
}
}