Files
cms.uldp.edu.vn/models/booking.js
r2xrzh9q2z-lab d1b931d547 first commit
2026-02-02 11:07:09 +07:00

106 lines
1.9 KiB
JavaScript

const mongoose = require("mongoose");
// Clear cache
if (mongoose.models.Booking) {
delete mongoose.models.Booking;
}
if (mongoose.connection.models.Booking) {
delete mongoose.connection.models.Booking;
}
const bookingSchema = new mongoose.Schema(
{
hero: {
title: String,
backgroundImage: String,
},
searchBar: {
locationLabel: String,
holidaySeasonLabel: String,
searchButtonText: String,
},
filterPanel: {
title: String,
priceTitle: String,
priceLabel: String,
pricePlaceholder: String,
priceMin: Number,
priceMax: Number,
activitiesTitle: String,
ageTitle: String,
ageSelectPlaceholder: String,
ageMin: Number,
ageMax: Number,
ratingTitle: String,
ratingOptions: [
{
value: String,
label: String,
},
],
resetButtonText: String,
},
programs: [
{
value: String,
label: String,
},
],
holidays: [
{
value: String,
label: String,
},
],
locations: [
{
value: String,
label: String,
},
],
camps: [
{
name: String,
price: Number,
priceText: String,
season: [String],
age: [Number],
locations: [String],
image: String,
link: String,
program: String,
rating: Number,
},
],
// Configuration - Dùng Mixed type để chấp nhận bất kỳ structure nào
configuration: mongoose.Schema.Types.Mixed,
formSteps: [
{
step: Number,
title: String,
sections: [
{
id: String,
fields: [mongoose.Schema.Types.Mixed],
},
],
},
],
validation: mongoose.Schema.Types.Mixed,
},
{
timestamps: true,
strict: false
}
);
module.exports = mongoose.model("Booking", bookingSchema);