contact.model.js 845 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const mongoose = require('mongoose');
  2. const ContactSchema = new mongoose.Schema(
  3. {
  4. lastname: {
  5. type: String,
  6. required: true,
  7. minlength: 2
  8. },
  9. email: {
  10. type: String,
  11. required: true,
  12. minlength: 2
  13. },
  14. created_date: {
  15. type: Date,
  16. default: Date.now,
  17. required: true
  18. },
  19. message: {
  20. type: String,
  21. required: true,
  22. minlength: 2
  23. },
  24. response: {
  25. type: String,
  26. },
  27. is_closed: {
  28. type: Boolean,
  29. },
  30. response_date: {
  31. type: Date
  32. },
  33. }
  34. );
  35. exports.ContactSchema = ContactSchema;
  36. Contact = mongoose.model('Contact', ContactSchema );
  37. exports.Contact = Contact;