that's the last of it!! :D

This commit is contained in:
Julian Lam
2014-01-10 16:00:03 -05:00
parent a2329980c8
commit a150691b5e
16 changed files with 623 additions and 313 deletions

39
src/socket.io/groups.js Normal file
View File

@@ -0,0 +1,39 @@
var groups = require('../groups'),
SocketGroups = {};
SocketGroups.create = function(data, callback) {
groups.create(data.name, data.description, function(err, groupObj) {
callback(err ? err.message : null, groupObj || undefined);
});
};
SocketGroups.delete = function(gid, callback) {
groups.destroy(gid, function(err) {
callback(err ? err.message : null, err ? null : 'OK');
});
};
SocketGroups.get = function(gid, callback) {
groups.get(gid, {
expand: true
}, function(err, groupObj) {
callback(err ? err.message : null, groupObj || undefined);
});
};
SocketGroups.join = function(data, callback) {
groups.join(data.gid, data.uid, callback);
};
SocketGroups.leave = function(data, callback) {
groups.leave(data.gid, data.uid, callback);
};
SocketGroups.update = function(data, callback) {
groups.update(data.gid, data.values, function(err) {
callback(err ? err.message : null);
});
};
module.exports = SocketGroups;