diff --git a/api-server/src/server/boot/certificate.js b/api-server/src/server/boot/certificate.js index 1bc230b3c41..feb1296a87d 100644 --- a/api-server/src/server/boot/certificate.js +++ b/api-server/src/server/boot/certificate.js @@ -16,7 +16,7 @@ import { } from '../../../../config/certification-settings'; import { reportError } from '../middlewares/sentry-error-handler.js'; -import { deprecatedEndpoint } from '../utils/deprecatedEndpoint'; +import { deprecatedEndpoint } from '../utils/disabled-endpoints'; import { getChallenges } from '../utils/get-curriculum'; import { ifNoUser401 } from '../utils/middleware'; import { observeQuery } from '../utils/rx'; diff --git a/api-server/src/server/boot/randomAPIs.js b/api-server/src/server/boot/randomAPIs.js index ad8500fd033..ca91e1f4410 100644 --- a/api-server/src/server/boot/randomAPIs.js +++ b/api-server/src/server/boot/randomAPIs.js @@ -1,5 +1,5 @@ import { getRedirectParams } from '../utils/redirection'; -import { deprecatedEndpoint } from '../utils/deprecatedEndpoint'; +import { deprecatedEndpoint } from '../utils/disabled-endpoints'; module.exports = function (app) { const router = app.loopback.Router(); diff --git a/api-server/src/server/boot/settings.js b/api-server/src/server/boot/settings.js index 41c72d74ea9..8d0bdf44c70 100644 --- a/api-server/src/server/boot/settings.js +++ b/api-server/src/server/boot/settings.js @@ -5,7 +5,10 @@ import isURL from 'validator/lib/isURL'; import { isValidUsername } from '../../../../utils/validate'; import { alertTypes } from '../../common/utils/flash.js'; -import { deprecatedEndpoint } from '../utils/deprecatedEndpoint'; +import { + deprecatedEndpoint, + temporarilyDisabledEndpoint +} from '../utils/disabled-endpoints'; import { ifNoUser401, createValidatorErrorHandler } from '../utils/middleware'; const log = debug('fcc:boot:settings'); @@ -18,13 +21,15 @@ export default function settingsController(app) { api.put('/update-privacy-terms', ifNoUser401, updatePrivacyTerms); api.post('/refetch-user-completed-challenges', deprecatedEndpoint); - api.post( - '/update-my-current-challenge', - ifNoUser401, - updateMyCurrentChallengeValidators, - createValidatorErrorHandler(alertTypes.danger), - updateMyCurrentChallenge - ); + // Re-enable once we can handle the traffic + // api.post( + // '/update-my-current-challenge', + // ifNoUser401, + // updateMyCurrentChallengeValidators, + // createValidatorErrorHandler(alertTypes.danger), + // updateMyCurrentChallenge + // ); + api.post('/update-my-current-challenge', temporarilyDisabledEndpoint); api.put('/update-my-portfolio', ifNoUser401, updateMyPortfolio); api.put('/update-my-theme', ifNoUser401, updateMyTheme); api.put('/update-my-about', ifNoUser401, updateMyAbout); @@ -78,29 +83,31 @@ function updateMyEmail(req, res, next) { .subscribe(message => res.json({ message }), next); } -const updateMyCurrentChallengeValidators = [ - check('currentChallengeId') - .isMongoId() - .withMessage('currentChallengeId is not a valid challenge ID') -]; +// Re-enable once we can handle the traffic +// const updateMyCurrentChallengeValidators = [ +// check('currentChallengeId') +// .isMongoId() +// .withMessage('currentChallengeId is not a valid challenge ID') +// ]; -function updateMyCurrentChallenge(req, res, next) { - const { - user, - body: { currentChallengeId } - } = req; - return user.updateAttribute( - 'currentChallengeId', - currentChallengeId, - (err, updatedUser) => { - if (err) { - return next(err); - } - const { currentChallengeId } = updatedUser; - return res.status(200).json(currentChallengeId); - } - ); -} +// Re-enable once we can handle the traffic +// function updateMyCurrentChallenge(req, res, next) { +// const { +// user, +// body: { currentChallengeId } +// } = req; +// return user.updateAttribute( +// 'currentChallengeId', +// currentChallengeId, +// (err, updatedUser) => { +// if (err) { +// return next(err); +// } +// const { currentChallengeId } = updatedUser; +// return res.status(200).json(currentChallengeId); +// } +// ); +// } function updateMyPortfolio(...args) { const portfolioKeys = ['id', 'title', 'description', 'url', 'image']; diff --git a/api-server/src/server/utils/deprecatedEndpoint.js b/api-server/src/server/utils/deprecatedEndpoint.js deleted file mode 100644 index 1b5338153ef..00000000000 --- a/api-server/src/server/utils/deprecatedEndpoint.js +++ /dev/null @@ -1,8 +0,0 @@ -export function deprecatedEndpoint(_, res) { - return res.status(410).json({ - message: { - type: 'info', - message: 'Please reload the app, this feature is no longer available.' - } - }); -} diff --git a/api-server/src/server/utils/disabled-endpoints.js b/api-server/src/server/utils/disabled-endpoints.js new file mode 100644 index 00000000000..c63f10cb20d --- /dev/null +++ b/api-server/src/server/utils/disabled-endpoints.js @@ -0,0 +1,17 @@ +export function deprecatedEndpoint(_, res) { + return res.status(410).json({ + message: { + type: 'info', + message: 'Please reload the app, this feature is no longer available.' + } + }); +} + +export function temporarilyDisabledEndpoint(_, res) { + return res.status(404).json({ + message: { + type: 'info', + message: 'Please reload the app, this feature is no longer available.' + } + }); +}