message.schema.ts 706 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import mongoose from 'mongoose';
  2. const { Schema } = mongoose;
  3. const appData = {
  4. msgId: {
  5. type: String,
  6. required: true,
  7. },
  8. msgLogDateTime: {
  9. type: Date,
  10. required: true,
  11. default: () => Date.now()
  12. },
  13. msgDateTime: {
  14. type: Date,
  15. required: true,
  16. default: () => Date.now()
  17. },
  18. msgTag: [String],
  19. msgPayload: {
  20. type: String,
  21. required: true
  22. }
  23. }
  24. const appDataSchema = new mongoose.Schema(
  25. appData
  26. )
  27. const messageSchema = new mongoose.Schema({
  28. appLogLocId: {
  29. type: String,
  30. ref: `appLogLoc`,
  31. required: true
  32. },
  33. appData: appData
  34. });
  35. module.exports = messageSchema