All files / Zapcard_API/models card.js

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3
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      1x         1x                                                       1x  
/**
* Module Dependencies
*/
const mongoose = require('mongoose');
 
/**
* Define the Database structure for Card (Schema)
*/
const CardSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
    trim: true,
  },
  description: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Description',
  },
  email: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Email',
  },
  telephone: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Telephone',
  },
  createdBy: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true,
  },
});
 
/**
* Make the Schema available in the app
*/
module.exports = mongoose.model('Card', CardSchema);