forked from UKSOURCE/cms.hailearning.edu.vn
116 lines
2.3 KiB
JavaScript
116 lines
2.3 KiB
JavaScript
const mongoose = require("mongoose");
|
|
|
|
const socialLinkSchema = new mongoose.Schema(
|
|
{
|
|
platform: {
|
|
type: String,
|
|
required: true,
|
|
enum: ["linkedin", "twitter", "instagram", "youtube", "facebook"],
|
|
},
|
|
url: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
icon: String,
|
|
order: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
},
|
|
{ _id: false },
|
|
);
|
|
|
|
const languageSchema = new mongoose.Schema(
|
|
{
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
value: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
},
|
|
{ _id: false },
|
|
);
|
|
|
|
const menuItemSchema = new mongoose.Schema(
|
|
{
|
|
label: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
href: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
icon: String,
|
|
order: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
children: [this],
|
|
},
|
|
{ _id: false },
|
|
);
|
|
|
|
const headerSchema = new mongoose.Schema(
|
|
{
|
|
// Top bar
|
|
top: {
|
|
phone: String,
|
|
email: String,
|
|
location: String,
|
|
socialLinks: [socialLinkSchema],
|
|
languages: [languageSchema],
|
|
},
|
|
|
|
// Offcanvas
|
|
offcanvas: {
|
|
description: String,
|
|
contactInfo: {
|
|
address: String,
|
|
email: String,
|
|
workingHours: String,
|
|
phone: String,
|
|
},
|
|
},
|
|
|
|
// Menu
|
|
menu: [menuItemSchema],
|
|
|
|
// Logo
|
|
logo: {
|
|
light: String,
|
|
dark: String,
|
|
alt: String,
|
|
},
|
|
|
|
// CTA Button
|
|
ctaButton: {
|
|
label: String,
|
|
href: String,
|
|
style: {
|
|
type: String,
|
|
enum: ["primary", "secondary", "outline"],
|
|
default: "primary",
|
|
},
|
|
},
|
|
|
|
// Status
|
|
status: {
|
|
type: String,
|
|
enum: ["active", "inactive"],
|
|
default: "active",
|
|
},
|
|
|
|
order: {
|
|
type: Number,
|
|
default: 1,
|
|
},
|
|
},
|
|
{ timestamps: true },
|
|
);
|
|
|
|
module.exports = mongoose.model("Header", headerSchema);
|