message.schema.ts 851 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. const grpcMessageSchema = new mongoose.Schema({
  36. id: {
  37. type: String,
  38. required: true
  39. },
  40. message: messageSchema
  41. })
  42. module.exports = grpcMessageSchema