-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.js
More file actions
29 lines (27 loc) · 901 Bytes
/
article.js
File metadata and controls
29 lines (27 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const mongoose = require('mongoose');
const ms = require('ms');
const articleSchema = mongoose.Schema({
_id: { type: mongoose.Schema.Types.ObjectId, auto: true },
feeds: {
type: [mongoose.Schema.Types.ObjectId],
ref: 'Feed',
required: true
},
url: { type: String, required: true },
title: { type: String, required: true },
description: { type: String },
content: { type: String },
author: { type: String },
image: { type: String },
tags: { type: [String] },
creator: { type: String },
published: { type: Date, required: true },
created: { type: Date, default: Date.now },
expires: { type: Date, default: Date.now, expires: ms('30 days') / 1000 },
readBy: {
type: [mongoose.Schema.Types.ObjectId],
ref: 'User',
default: []
}
});
module.exports = mongoose.model('Article', articleSchema);