Browse Source

Merge pull request #9 from stakwork/del-msgs

Del msgs
feature/dockerfile-arm v0.8.6
Evan Feenstra 5 years ago
committed by GitHub
parent
commit
e96c9a924d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      api/controllers/index.ts
  2. 9
      api/controllers/messages.ts
  3. 1
      dist/api/controllers/index.js
  4. 2
      dist/api/controllers/index.js.map
  5. 8
      dist/api/controllers/messages.js
  6. 2
      dist/api/controllers/messages.js.map

1
api/controllers/index.ts

@ -79,6 +79,7 @@ async function set(app) {
app.delete('/contacts/:id', controllers.contacts.deleteContact)
app.get('/messages', controllers.messages.getMessages)
app.delete('/message/:id', controllers.messages.deleteMessage)
app.post('/messages', controllers.messages.sendMessage)
app.post('/messages/:chat_id/read', controllers.messages.readMessages)
app.post('/messages/clear', controllers.messages.clearMessages)

9
api/controllers/messages.ts

@ -83,6 +83,12 @@ const getAllMessages = async (req, res) => {
})
};
async function deleteMessage(req, res){
const id = req.params.id
await models.Message.destroy({ where: {id} })
success(res, {id})
}
const sendMessage = async (req, res) => {
// try {
// schemas.message.validateSync(req.body)
@ -203,5 +209,6 @@ export {
sendMessage,
receiveMessage,
clearMessages,
readMessages
readMessages,
deleteMessage
}

1
dist/api/controllers/index.js

@ -84,6 +84,7 @@ function set(app) {
app.post('/contacts', controllers.contacts.createContact);
app.delete('/contacts/:id', controllers.contacts.deleteContact);
app.get('/messages', controllers.messages.getMessages);
app.delete('/message/:id', controllers.messages.deleteMessage);
app.post('/messages', controllers.messages.sendMessage);
app.post('/messages/:chat_id/read', controllers.messages.readMessages);
app.post('/messages/clear', controllers.messages.clearMessages);

2
dist/api/controllers/index.js.map

File diff suppressed because one or more lines are too long

8
dist/api/controllers/messages.js

@ -78,6 +78,14 @@ const getAllMessages = (req, res) => __awaiter(void 0, void 0, void 0, function*
confirmed_messages: []
});
});
function deleteMessage(req, res) {
return __awaiter(this, void 0, void 0, function* () {
const id = req.params.id;
yield models_1.models.Message.destroy({ where: { id } });
res_1.success(res, { id });
});
}
exports.deleteMessage = deleteMessage;
const sendMessage = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
// try {
// schemas.message.validateSync(req.body)

2
dist/api/controllers/messages.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save