Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Add delete to simple storage #300

Merged
merged 2 commits into from
Nov 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/storage/simple_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ module.exports = function(config) {
save: function(team_data, cb) {
teams_db.save(team_data.id, team_data, cb);
},
delete: function(team_id, cb) {
teams_db.delete(team_id.id, cb);
},
all: function(cb) {
teams_db.all(objectsToList(cb));
}
Expand All @@ -67,6 +70,9 @@ module.exports = function(config) {
save: function(user, cb) {
users_db.save(user.id, user, cb);
},
delete: function(user_id, cb) {
users_db.delete(user_id.id, cb);
},
all: function(cb) {
users_db.all(objectsToList(cb));
}
Expand All @@ -78,6 +84,9 @@ module.exports = function(config) {
save: function(channel, cb) {
channels_db.save(channel.id, channel, cb);
},
delete: function(channel_id, cb) {
channels_db.delete(channel_id.id, cb);
},
all: function(cb) {
channels_db.all(objectsToList(cb));
}
Expand Down
9 changes: 6 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Multi-message replies, particularly those that present questions for the end use
can be sent using the `bot.startConversation()` function and the related conversation sub-functions.

Bots can originate messages - that is, send a message based on some internal logic or external stimulus -
using `bot.say()` method.
using `bot.say()` method.

All `message` objects must contain a `text` property, even if it's only an empty string.

Expand Down Expand Up @@ -704,7 +704,7 @@ and override the built in regular expression matching.
### Receive Middleware

Receive middleware can be used to do things like preprocess the message
content using external natural language processing services like Wit.ai.
content using external natural language processing services like Wit.ai.
Additional information can be added to the message object for use down the chain.

```
Expand All @@ -721,7 +721,7 @@ controller.middleware.receive.use(function(bot, message, next) {
### Send Middleware

Send middleware can be used to do things like preprocess the message
content before it gets sent out to the messaging client.
content before it gets sent out to the messaging client.

```
controller.middleware.send.use(function(bot, message, next) {
Expand Down Expand Up @@ -801,14 +801,17 @@ This system supports freeform storage on a team-by-team, user-by-user, and chann
```javascript
controller.storage.users.save({id: message.user, foo:'bar'}, function(err) { ... });
controller.storage.users.get(id, function(err, user_data) {...});
controller.storage.users.delete(id, function(err) {...});
controller.storage.users.all(function(err, all_user_data) {...});

controller.storage.channels.save({id: message.channel, foo:'bar'}, function(err) { ... });
controller.storage.channels.get(id, function(err, channel_data) {...});
controller.storage.channels.delete(id, function(err) {...});
controller.storage.channels.all(function(err, all_channel_data) {...});

controller.storage.teams.save({id: message.team, foo:'bar'}, function(err) { ... });
controller.storage.teams.get(id, function(err, team_data) {...});
controller.storage.teams.delete(id, function(err) {...});
controller.storage.teams.all(function(err, all_team_data) {...});
```

Expand Down