added readAck to the httpAPI, aswell as attachMetadata to make it clean

master
cheetah 4 years ago
parent 1ed24894b7
commit 4616737483

@ -50,8 +50,23 @@ app.get('/api/message/recent', async (req, res) => {
return res.json(msgs) return res.json(msgs)
}) })
app.get('/api/message/ack/recv/:id', async (req, res) => { //TODO: make this fancy app.get('/api/message/ack/recv/:id', async (req, res) => {
types.ConnectorRegistry.reportDelivered({ id: req.params.id }, 'http') types.ConnectorRegistry.reportDelivered({ id: req.params.id }, 'http')
require('../MessageManager').attachMetadata(req.params.id, {
ack: 'recv',
rssi: 0x00,
date: new Date(),
metadata: { http: true },
})
return res.json(true)
})
app.get('/api/message/ack/read/:id', async (req, res) => {
types.MessageManager.markMessageRead(req.params.id)
require('../MessageManager').attachMetadata(req.params.id, {
ack: 'read',
date: new Date(),
metadata: { http: true },
})
return res.json(true) return res.json(true)
}) })

Loading…
Cancel
Save