-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmicroEntry.schema.js
41 lines (41 loc) · 953 Bytes
/
microEntry.schema.js
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
30
31
32
33
34
35
36
37
38
39
40
41
import mongoose from 'mongoose';
import { NETWORKS } from '../../../api/helpers/socialMedia.js';
export const MicroEntrySchema = new mongoose.Schema(
{
title: String,
slug: { type: String, required: true, unique: true },
post: { type: Object },
tags: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Tag',
},
],
relatedPost: {
type: mongoose.Schema.Types.ObjectId,
refPath: 'relatedPostModel',
},
relatedPostModel: {
type: String,
enum: ['ShortformEntry', 'PressEntry'],
},
socialLinks: [
{
type: {
type: String,
enum: NETWORKS,
},
postId: { type: String },
},
],
webmentions: [
{
type: mongoose.Schema.Types.ObjectId,
ref: 'Webmention',
},
],
_id: { type: mongoose.Schema.Types.ObjectId, required: true },
deletedAt: Date,
},
{ timestamps: true },
);