// feed-entry.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0

'use strict';

const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const FeedEntrySchema = new Schema({
  feed: { type: Schema.ObjectId, required: true, index: 1, ref: 'Feed' },
  published: { type: Date },
  title: { type: String },
  description: { type: String },
  link: { type: String, index: 1 },
});

FeedEntrySchema.index({
  feed: 1,
  link: 1,
}, {
  name: 'feed_entry_by_feed_idx',
});

module.exports = mongoose.model('FeedEntry', FeedEntrySchema);