Files

103 lines
2.3 KiB
JavaScript

const mongoose = require("mongoose");
const { Schema } = mongoose;
// Brand
const LogoSchema = new Schema(
{
image: { type: String, default: "" },
href: { type: String, default: "/" },
},
{ _id: false },
);
const SocialItemSchema = new Schema(
{
icon: { type: String, default: "" },
href: { type: String, default: "#" },
},
{ _id: false },
);
const BrandSchema = new Schema(
{
logo: { type: LogoSchema, default: () => ({}) },
description: { type: String, default: "" },
social: { type: [SocialItemSchema], default: [] },
},
{ _id: false },
);
// Explore
const ExploreLinkSchema = new Schema(
{
label: { type: String, default: "" },
href: { type: String, default: "#" },
},
{ _id: false },
);
const ExploreSchema = new Schema(
{
heading: { type: String, default: "" },
links: { type: [ExploreLinkSchema], default: [] },
},
{ _id: false },
);
// Contact
const ContactSchema = new Schema(
{
heading: { type: String, default: "" },
address: { type: String, default: "" },
phone: { type: String, default: "" },
email: { type: String, default: "" },
},
{ _id: false },
);
// Newsletter
const NewsletterSchema = new Schema(
{
heading: { type: String, default: "" },
description: { type: String, default: "" },
placeholder: { type: String, default: "" },
buttonText: { type: String, default: "" },
},
{ _id: false },
);
// Bottom
const BottomLinkSchema = new Schema(
{
label: { type: String, default: "" },
href: { type: String, default: "#" },
},
{ _id: false },
);
const BottomSchema = new Schema(
{
copyright: { type: String, default: "" },
links: { type: [BottomLinkSchema], default: [] },
},
{ _id: false },
);
// Root
const FooterSchema = new Schema(
{
brand: { type: BrandSchema, default: () => ({}) },
explore: { type: ExploreSchema, default: () => ({}) },
contact: { type: ContactSchema, default: () => ({}) },
newsletter: { type: NewsletterSchema, default: () => ({}) },
bottom: { type: BottomSchema, default: () => ({}) },
},
{
timestamps: true,
strict: false,
},
);
module.exports = mongoose.model("Footer", FooterSchema);