2021-05-18 23:52:26 -07:00
|
|
|
const mongoose = require("mongoose");
|
2021-05-19 03:18:45 -07:00
|
|
|
|
2021-05-18 23:52:26 -07:00
|
|
|
const blogSchema = new mongoose.Schema({
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
require: true,
|
|
|
|
},
|
2021-05-19 23:44:03 -07:00
|
|
|
author: { required: true, type: String },
|
2021-05-18 23:52:26 -07:00
|
|
|
date: {
|
|
|
|
type: Date,
|
|
|
|
},
|
|
|
|
image: {
|
2021-05-26 03:05:16 -07:00
|
|
|
type: Object,
|
2021-05-18 23:52:26 -07:00
|
|
|
default: "",
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
isBookMarked: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2021-06-02 04:28:01 -07:00
|
|
|
comments: [
|
|
|
|
{
|
|
|
|
user: { type: mongoose.Schema.Types.ObjectId, ref: "Users" },
|
|
|
|
review: {
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
date: {
|
|
|
|
type: Date,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2021-05-18 23:52:26 -07:00
|
|
|
});
|
|
|
|
module.exports = mongoose.model("Blog", blogSchema);
|