// @ts-check
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const PostSchema = new Schema({
  title: { type: String, required: true },
  date: { type: Date, required: true, index: true },
  category: String,
  teaser: String,
  cover: String,
  to: String,
  bodyMd: String,
  createdAt: { type: Date, default: Date.now }
}, { collection: 'posts', versionKey: false });

var PostModel = module.exports = mongoose.model('Post', PostSchema);
