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

90
models/Content.js Normal file
View File

@@ -0,0 +1,90 @@
const mongoose = require('mongoose');
const contentSchema = new mongoose.Schema({
// Content identification
page: {
type: String,
required: true,
unique: true,
enum: ['home', 'about', 'contact', 'rooms', 'facilities', 'gallery']
},
// Hero section
hero: {
title: String,
subtitle: String,
description: String,
backgroundImage: String,
ctaText: String,
ctaLink: String
},
// Page sections (flexible structure for different pages)
sections: [{
sectionId: String, // e.g., 'welcome', 'features', 'testimonials'
title: String,
subtitle: String,
content: String,
image: String,
order: Number,
isActive: {
type: Boolean,
default: true
},
// Additional fields for different section types
items: [mongoose.Schema.Types.Mixed], // For lists, features, etc.
backgroundImage: String,
backgroundVideo: String,
layout: String // 'left-image', 'right-image', 'full-width', etc.
}],
// Meta information for SEO
seo: {
title: String,
description: String,
keywords: [String],
ogImage: String,
canonicalUrl: String
},
// Version control
version: {
type: Number,
default: 1
},
isPublished: {
type: Boolean,
default: true
},
publishedAt: Date,
// Audit trail
lastModifiedBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Admin'
}
}, {
timestamps: true,
toJSON: { virtuals: true },
toObject: { virtuals: true }
});
// Indexes
contentSchema.index({ page: 1 });
contentSchema.index({ isPublished: 1 });
// Pre-save middleware to update version and publish date
contentSchema.pre('save', function(next) {
if (this.isModified() && !this.isNew) {
this.version += 1;
}
if (this.isModified('isPublished') && this.isPublished) {
this.publishedAt = new Date();
}
next();
});
module.exports = mongoose.model('Content', contentSchema);