Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions backend/models/News.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const mongoose = require('mongoose');

const newsSchema = new mongoose.Schema({
title: {
type: String,
trim: true,
},
content: {
type: String,
trim: true,
},
type: {
type: String,
required: [true, 'Please provide News type!'],
enum: {
values: [
'India News',
'Geopolitical News',
'Entertainment News',
'Political News',
'Cricket News',
],
message:
'Sorry! News type could be either Indian or Entertainment or Political or Geopolitical or Cricket News.',
},
},

abstract: {
type: String,
},

photos: [String],
timeStamp: {
type: Object,
published_at: {
type: Date,
},
created_at: {
type: Date,
},
updated_at: {
type: Date,
},
},
});

module.exports = mongoose.model('News', newsSchema);