Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. var userrSchema = new mongoose.Schema({
  2. email : {
  3. type: String,
  4. required: "Email can't be empty.",
  5. // unique: true
  6. },
  7. password: {
  8. type: String,
  9. required: "Password name can't be empty."
  10. },
  11. firstName : {
  12. type: String,
  13. required: "First name can't be empty."
  14. },
  15. lastName : {
  16. type: String,
  17. required: "Last name can't be empty."
  18. },
  19. phoneNumber : {
  20. type: String,
  21. required: "Reqired for further contact. Can't be empty."
  22. },
  23. verify: String,
  24. role: String,
  25. emailResetTokennn: String,
  26. emailExpiress: Date,
  27. saltSecret: String
  28. });
  29.  
  30. mongoose.model('Userr' , userrSchema);
  31.  
  32. //define admin(main) schema
  33. var adminSchema = new mongoose.Schema({
  34. companyName : {
  35. type: String,
  36. required: "Company name can't be empty.",
  37. required: false
  38. },
  39. companyID: {
  40. type: String,
  41. },
  42. address : {
  43. type: String,
  44. required: "Address can't be empty.",
  45. },
  46. contactDetails : {
  47. type: String,
  48. required: "Company contact number can't be empty.",
  49. },
  50. admins: {
  51. _id: mongoose.Schema.Types.ObjectId,
  52. email : {
  53. type: String,
  54. required: "Email can't be empty.",
  55. unique: true
  56. },
  57. password: {
  58. type: String,
  59. required: "Password name can't be empty."
  60. },
  61. firstName : {
  62. type: String,
  63. required: "First name can't be empty."
  64. },
  65. lastName : {
  66. type: String,
  67. required: "Last name can't be empty."
  68. },
  69. phoneNumber : {
  70. type: String,
  71. required: "Reqired for further contact. Can't be empty."
  72. },
  73. designation : {
  74. type: String,
  75. required: "Designation can't be empty."
  76. },
  77. verified: String,
  78. role: String,
  79. emailResetTokenn: String,
  80. emailExpires: Date,
  81. saltSecret: String,//this is user for encryption and decryption of password
  82. users:[ { type: mongoose.Schema.Types.ObjectId, ref: 'Userr' } ]
  83. }
  84. });
  85. mongoose.model('Admin', adminSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement