full
This commit is contained in:
26
models/InstagramImportedPostModel.js
Normal file
26
models/InstagramImportedPostModel.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const mongoose = require('mongoose');
|
||||
const timestamp = require('mongoose-timestamp');
|
||||
|
||||
const modelSchema = new mongoose.Schema({
|
||||
user: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'User',
|
||||
required: true,
|
||||
},
|
||||
instagram_media_id: {
|
||||
type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
},
|
||||
post: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
ref: 'Post',
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
modelSchema.index({ user: 1, instagram_media_id: 1 }, { unique: true });
|
||||
modelSchema.plugin(timestamp);
|
||||
|
||||
const InstagramImportedPostModel = mongoose.model('InstagramImportedPost', modelSchema);
|
||||
module.exports = InstagramImportedPostModel;
|
||||
Reference in New Issue
Block a user