/**
* Module Dependencies
*/
const mongoose = require('mongoose');
/**
* Define the Database structure for Relationship (Schema)
*/
const RelationshipSchema = new mongoose.Schema({
sharingUser: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: false,
},
receivingUser: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
},
sharedCards: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Card',
required: true,
}],
});
/**
* Make the Schema available in the app
*/
module.exports = mongoose.model('Relationship', RelationshipSchema);
|