Guest User

Untitled

a guest
Mar 30th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. const patientSchema = new Schema({
  2. firstName: {type: String, required: true},
  3. lastName: {type: String, required: true},
  4. address: {type: String, required: true},
  5. address2: {type: String},
  6. city: {type: String, required: true},
  7. state: {type: String, required: true},
  8. zip: {type: String, required: true},
  9. preferredLanguage: {type: String, required: true},
  10. medicalCond: {type: String, required: true},
  11. medication: {type: String},
  12. allergies: {type: String},
  13. notes: {type: String},
  14. primaryCareName: {type: String},
  15. primaryCareNumber: {type: String},
  16. contactFirstName: {type: String, required: true},
  17. contactLastName: {type: String, required: true},
  18. contactRelationship: {type: String, required: true},
  19. contactNumb: {type: String, required: true}
  20. });
  21.  
  22. const caretakerSchema = new Schema({
  23. username: {type: String, unique: true, required: true},
  24. password: {type: String, required: true},
  25. phoneNumb: {type: String, required: true},
  26. local: {
  27. username: {type: String, unique: true},
  28. password: {type: String, unique: true}
  29. },
  30.  
  31. patient: [{
  32. type: Schema.Types.ObjectId,
  33. ref: "Patient"
  34. }]
  35. });
  36.  
  37. findById: function(req, res) {
  38. db.Caretaker
  39. .findOne({_id: req.params.id})
  40. .populate("patient")
  41. .then(dbModel => res.json(dbModel))
  42. .catch(err => res.status(422).json(err));
  43. }
Add Comment
Please, Sign In to add comment