Files
unai/scripts/create-test-university.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

127 lines
4.1 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function createTestUniversity() {
try {
// Check if test university already exists
const existingUniversity = await prisma.university.findUnique({
where: { slug: 'test-university' }
});
if (existingUniversity) {
console.log('✅ Test university already exists');
return existingUniversity;
}
// Create test university
const university = await prisma.university.create({
data: {
slug: 'test-university',
name: 'Test University',
shortName: 'TU',
domain: 'test-university.localhost',
subdomain: 'test',
branding: {
primaryColor: '#2563eb',
secondaryColor: '#1e40af',
logo: '/images/logo.png',
favicon: '/favicon.ico',
theme: 'modern'
},
contact: {
email: 'info@test-university.edu',
phone: '+1-555-0123',
address: '123 University Ave, Test City, TC 12345',
website: 'https://test-university.edu'
},
features: {
chatbot: true,
multiLanguage: true,
onlineApplications: true,
studentPortal: true,
courseManagement: true,
contentManagement: true
},
ai: {
provider: 'openrouter',
model: 'anthropic/claude-3.5-sonnet',
apiKey: process.env.OPENROUTER_API_KEY || '',
knowledgeBase: true,
chatHistory: true,
languageSupport: ['en', 'ar']
},
status: 'ACTIVE'
}
});
console.log('✅ Test university created successfully:');
console.log(` Name: ${university.name}`);
console.log(` Slug: ${university.slug}`);
console.log(` Domain: ${university.domain}`);
console.log(` Status: ${university.status}`);
// Create some sample content
await prisma.universityContent.create({
data: {
universityId: university.id,
contentType: 'ABOUT',
title: 'About Test University',
titleAr: 'عن الجامعة التجريبية',
content: 'Test University is a leading institution dedicated to academic excellence and innovation.',
contentAr: 'الجامعة التجريبية هي مؤسسة رائدة مكرسة للتميز الأكاديمي والابتكار.',
isPublished: true
}
});
// Create sample programs
await prisma.academicProgram.create({
data: {
universityId: university.id,
title: 'Bachelor of Computer Science',
titleAr: 'بكالوريوس علوم الحاسوب',
description: 'A comprehensive program in computer science and software engineering.',
descriptionAr: 'برنامج شامل في علوم الحاسوب وهندسة البرمجيات.',
level: 'UNDERGRADUATE',
duration: '4 years',
fees: '$15,000 per year',
entryRequirements: 'High school diploma with mathematics and science',
isActive: true
}
});
// Create sample knowledge base entries
await prisma.aIKnowledgeBase.create({
data: {
universityId: university.id,
category: 'Admissions',
question: 'How do I apply for admission?',
questionAr: 'كيف أتقدم للقبول؟',
answer: 'You can apply online through our website or contact our admissions office.',
answerAr: 'يمكنك التقديم عبر الإنترنت من خلال موقعنا الإلكتروني أو الاتصال بمكتب القبول.',
priority: 1,
isActive: true
}
});
console.log('✅ Sample content created successfully');
return university;
} catch (error) {
console.error('❌ Error creating test university:', error);
throw error;
} finally {
await prisma.$disconnect();
}
}
// Run the script
createTestUniversity()
.then(() => {
console.log('🎉 Test university setup completed!');
process.exit(0);
})
.catch((error) => {
console.error('💥 Setup failed:', error);
process.exit(1);
});