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

Commit

Permalink
Merge pull request #300 from jeremy-green/add-delete-to-jfs
Browse files Browse the repository at this point in the history
Add delete to simple storage
  • Loading branch information
Ben Brown authored Nov 7, 2016
2 parents 908171f + e1f69f3 commit 42c9928
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
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 @@ -292,7 +292,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 @@ -956,7 +956,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 @@ -973,7 +973,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 @@ -1053,14 +1053,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

0 comments on commit 42c9928

Please sign in to comment.