Comparing version 0.3.1 to 0.4.1
16
index.js
@@ -121,2 +121,18 @@ // Start node with DEBUG=socialdb to see debug output | ||
/** | ||
* deleteInvites() removes all invites for an invited id. | ||
* `invitedId` can be any form of identifier, like user id or phone number. | ||
*/ | ||
deleteInvites(invitedId) { | ||
return new Promise((resolve, reject) => { | ||
this.client.del( | ||
`${this.namespace}:user:${invitedId}:${STATE_KEY.invited}`, | ||
(err, res) => { | ||
if (err) { reject(err); } | ||
debug(`Deleted all invites for ${invitedId}`); | ||
return resolve(res); | ||
}); | ||
}); | ||
} | ||
/** | ||
* requested() returns a Promise with a list of requested friends for a given `userId`. | ||
@@ -123,0 +139,0 @@ * Sorted by date of creation (newest to oldest). |
{ | ||
"name": "socialdb", | ||
"version": "0.3.1", | ||
"version": "0.4.1", | ||
"description": "Redis-backed social graph for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -88,2 +88,13 @@ const assert = require('assert'); | ||
describe('.deleteInvites()', () => { | ||
it('should delete all invites', (done) => { | ||
sd.deleteInvites('some_id').then(() => { | ||
client.zcard('socialdb:user:some_id:invited', (err, count) => { | ||
assert.equal(count, 0); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
describe('.invited()', () => { | ||
@@ -90,0 +101,0 @@ it('should get a list of 0 invited users', (done) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70834
429