Sails.js 如何标记已读邮件?

Sails.js 如何标记已读邮件?,sails.js,sails-mongo,Sails.js,Sails Mongo,我正在SailsJS中实现一个消息传递应用程序,但我需要在读取时标记一条特定的消息 现在用户需要点击对话,浏览器将加载相关信息。我该怎么做 这是我的对话模式: module.exports = { attributes: { subject: 'STRING', related_product_id: 'INTEGER', related_product_name: 'STRING', related_product_price: 'STRING',

我正在SailsJS中实现一个消息传递应用程序,但我需要在读取时标记一条特定的消息

现在用户需要点击对话,浏览器将加载相关信息。我该怎么做

这是我的对话模式:

module.exports = {
  attributes: {
    subject: 'STRING',
    related_product_id: 'INTEGER',
    related_product_name: 'STRING',
    related_product_price: 'STRING',
    starter_name: 'STRING',
    recipients: {
        collection: 'recipient',
        via: 'conversation'
    },
    messages: {
        collection: 'message',
        via: 'conversation'
    }
  }
};
module.exports = {
  attributes: {
      body: 'string',
      sender_uid: 'string',
      file: 'string',
      conversation: {
           model: 'conversation'
      },
      read : {
          type : "boolean",
          defaultsTo : false
      }
  }
};
这是我的信息模型:

module.exports = {
  attributes: {
    subject: 'STRING',
    related_product_id: 'INTEGER',
    related_product_name: 'STRING',
    related_product_price: 'STRING',
    starter_name: 'STRING',
    recipients: {
        collection: 'recipient',
        via: 'conversation'
    },
    messages: {
        collection: 'message',
        via: 'conversation'
    }
  }
};
module.exports = {
  attributes: {
      body: 'string',
      sender_uid: 'string',
      file: 'string',
      conversation: {
           model: 'conversation'
      },
      read : {
          type : "boolean",
          defaultsTo : false
      }
  }
};

我已经在Message模型上设置了attrread,这将是我在读取时需要更改为True的字段。

您可以更具体一些吗?你似乎在问如何显示与对话相关的信息。这不是你的头衔所要求的。如果您询问如何将模型标记为已读。它就像put请求一样简单。或者你需要客户端ajax的帮助?你能更具体一点吗?你似乎在问如何显示与对话相关的信息。这不是你的头衔所要求的。如果您询问如何将模型标记为已读。它就像put请求一样简单。或者你需要客户端ajax的帮助?