Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 06d96db

Browse files
committed
Merge branch 'technology-2014-11-13' of https://github.com/cloudspokes/tc-api into dev
Conflicts: actions/user.js routes.js
2 parents 5bceb96 + de8c1f4 commit 06d96db

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

actions/user.js

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var async = require('async');
1313
var _ = require('underscore');
1414
var BadRequestError = require('../errors/BadRequestError');
1515
var ForbiddenError = require('../errors/ForbiddenError');
16+
var NotFoundError = require('../errors/NotFoundError');
1617
var UnauthorizedError = require('../errors/UnauthorizedError');
1718
var IllegalArgumentError = require('../errors/IllegalArgumentError');
1819

@@ -334,27 +335,33 @@ function getUserIdentityByAuth0Id(api, connection, next) {
334335
var helper = api.helper,
335336
auth0id = connection.params.id,
336337
userid = 0,
337-
dbConnectionMap = connection.dbConnectionMap,
338+
dbConnectionMap = connection.dbConnectionMap,
339+
notfound = new NotFoundError('Feelin lucky, punk?'),
338340
response;
339341

340342
async.waterfall([
341343
function (cb) {
342-
var splits = auth0id.split('|');
343-
if (splits[0] == 'ad') {
344-
cb(null, [{ user_id: Number(splits[1]) }]);
345-
} else {
346-
api.helper.getProviderId(splits[0], function(err, provider) {
347-
if (err) {
348-
cb(err);
349-
} else {
350-
api.dataAccess.executeQuery("get_user_by_social_login",
351-
{
352-
social_user_id: splits[1],
353-
provider_id: provider
354-
},
355-
dbConnectionMap, cb);
356-
}
357-
});
344+
try {
345+
var splits = auth0id.split('|');
346+
if (splits[0] == 'ad') {
347+
cb(null, [{ user_id: Number(splits[1]) }]);
348+
} else {
349+
api.helper.getProviderId(splits[0], function(err, provider) {
350+
if (err) {
351+
cb(notfound);
352+
} else {
353+
api.dataAccess.executeQuery("get_user_by_social_login",
354+
{
355+
social_user_id: splits[1],
356+
provider_id: provider
357+
},
358+
dbConnectionMap, cb);
359+
}
360+
});
361+
}
362+
}
363+
catch (exc) {
364+
cb(notfound);
358365
}
359366
},
360367
function (result, cb) {
@@ -364,12 +371,15 @@ function getUserIdentityByAuth0Id(api, connection, next) {
364371
dbConnectionMap, cb);
365372
},
366373
function (rs, cb) {
367-
response = {
368-
uid: userid,
369-
handle: rs[0].handle,
370-
email: rs[0].address
371-
};
372-
cb();
374+
if (!rs[0]) {
375+
cb(notfound);
376+
} else {
377+
response = {
378+
uid: userid,
379+
handle: rs[0].handle
380+
};
381+
cb();
382+
}
373383
}
374384
], function (err) {
375385
if (err) {

queries/active_data_science_challenges

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ FROM
1111
active_data_science_challenges
1212
WHERE
1313
submission_end_date BETWEEN TO_DATE('@submitByFrom@ 00:00:00', '%Y-%m-%d %H:%M:%S') AND TO_DATE('@submitByTo@ 23:59:59', '%Y-%m-%d %H:%M:%S')
14-
AND CURRENT BETWEEN registration_start_date AND submission_end_date
15-
ORDER BY challenge_id
14+
ORDER BY challenge_id

routes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ exports.routes = {
258258

259259
{ path: "/:apiVersion/user/challenges", action: "getMyChallenges" },
260260
{ path: "/:apiVersion/user/activation-email", action: "userActivationEmail" },
261-
{ path: "/:apiVersion/user/identity/:id", action: "getUserIdentityByAuth0Id" },
261+
{ path: "/:apiVersion/user/tcid/:id", action: "getUserIdentityByAuth0Id" },
262262
{ path: "/:apiVersion/user/identity", action: "getUserIdentity" },
263263

264264
{ path: "/:apiVersion/users/tops/:trackType", action: "getTopTrackMembers" },

0 commit comments

Comments
 (0)