Initial commit: CMS backend for Old Vine Hotel

- Complete Express.js API server
- MongoDB integration with Mongoose
- Admin authentication and authorization
- Room management (CRUD operations)
- Booking management system
- Guest management
- Payment processing (Stripe integration)
- Content management (pages, blog, gallery)
- Media upload and management
- Integration services (Booking.com, Expedia, Opera PMS, Trip.com)
- Email notifications
- Comprehensive logging and error handling
This commit is contained in:
Talal Sharabi
2026-01-06 12:21:56 +04:00
commit a3308a26e2
48 changed files with 15294 additions and 0 deletions

68
scripts/seedAdmin.js Normal file
View File

@@ -0,0 +1,68 @@
const mongoose = require('mongoose');
const Admin = require('../models/Admin');
require('dotenv').config();
const seedAdmin = async () => {
try {
// Connect to MongoDB
await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/oldvinehotel', {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log('Connected to MongoDB');
// Check if super admin already exists
const existingAdmin = await Admin.findOne({ isSuperAdmin: true });
if (existingAdmin) {
console.log('Super admin already exists:');
console.log('Username:', existingAdmin.username);
console.log('Email:', existingAdmin.email);
await mongoose.connection.close();
return;
}
// Create default super admin
const defaultAdmin = new Admin({
username: 'admin',
email: 'admin@oldvinehotel.com',
password: 'Admin@123456', // Change this in production!
firstName: 'Admin',
lastName: 'User',
role: 'super-admin',
isSuperAdmin: true,
permissions: [
'manage_content',
'manage_rooms',
'manage_bookings',
'manage_users',
'manage_blog',
'manage_gallery',
'manage_settings',
'view_analytics',
'manage_admins'
]
});
await defaultAdmin.save();
console.log('\n✅ Super admin created successfully!');
console.log('\n📝 Login Credentials:');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('Username: admin');
console.log('Email: admin@oldvinehotel.com');
console.log('Password: Admin@123456');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('\n⚠ Please change the password after first login!');
console.log('\n🌐 Admin Panel: http://localhost:3060/admin/login\n');
await mongoose.connection.close();
} catch (error) {
console.error('Error seeding admin:', error);
process.exit(1);
}
};
seedAdmin();