Skip to content
Browse files

add debug flag to giveBrowniePoints endpoint

  • Loading branch information...
1 parent f0aeb26 commit c2720d784cbc25bd666675771062df4ce9d39e2e @BerkeleyTrue BerkeleyTrue committed
Showing with 18 additions and 4 deletions.
  1. +18 −4 common/models/user.js
View
22 common/models/user.js
@@ -202,7 +202,7 @@ module.exports = function(User) {
);
User.giveBrowniePoints =
- function giveBrowniePoints(receiver, giver, data = {}, cb) {
+ function giveBrowniePoints(receiver, giver, data = {}, dev = false, cb) {
const findUser = observeMethod(User, 'findOne');
if (!receiver) {
return nextTick(() => {
@@ -262,9 +262,15 @@ module.exports = function(User) {
})
.subscribe(
(user) => {
- cb(null, getAboutProfile(user));
+ return cb(
+ null,
+ getAboutProfile(user),
+ dev ?
+ { giver, receiver, data } :
+ null
+ );
},
- cb,
+ (e) => cb(e, null, dev ? { giver, receiver, data } : null),
() => {
debug('brownie points assigned completed');
}
@@ -289,17 +295,25 @@ module.exports = function(User) {
{
arg: 'data',
type: 'object'
+ },
+ {
+ arg: 'debug',
+ type: 'boolean'
}
],
returns: [
{
arg: 'about',
type: 'object'
+ },
+ {
+ arg: 'debug',
+ type: 'object'
}
],
http: {
path: '/give-brownie-points',
- verb: 'get'
+ verb: 'POST'
}
}
);

0 comments on commit c2720d7

Please sign in to comment.
Something went wrong with that request. Please try again.