mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-24 10:00:52 -04:00
revert(api): decouple api from curriculum
This reverts commit c077ffe4b9
via PR #40703
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
454b267138
commit
8f0e441644
@@ -1,80 +0,0 @@
|
||||
import path from 'path';
|
||||
|
||||
import dedent from 'dedent';
|
||||
import loopback from 'loopback';
|
||||
import moment from 'moment';
|
||||
|
||||
export const renderSignUpEmail = loopback.template(
|
||||
path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'server',
|
||||
'views',
|
||||
'emails',
|
||||
'user-request-sign-up.ejs'
|
||||
)
|
||||
);
|
||||
|
||||
export const renderSignInEmail = loopback.template(
|
||||
path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'server',
|
||||
'views',
|
||||
'emails',
|
||||
'user-request-sign-in.ejs'
|
||||
)
|
||||
);
|
||||
|
||||
export const renderEmailChangeEmail = loopback.template(
|
||||
path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'server',
|
||||
'views',
|
||||
'emails',
|
||||
'user-request-update-email.ejs'
|
||||
)
|
||||
);
|
||||
|
||||
export function getWaitPeriod(ttl) {
|
||||
const fiveMinutesAgo = moment().subtract(5, 'minutes');
|
||||
const lastEmailSentAt = moment(new Date(ttl || null));
|
||||
const isWaitPeriodOver = ttl
|
||||
? lastEmailSentAt.isBefore(fiveMinutesAgo)
|
||||
: true;
|
||||
|
||||
if (!isWaitPeriodOver) {
|
||||
const minutesLeft = 5 - (moment().minutes() - lastEmailSentAt.minutes());
|
||||
return minutesLeft;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function getWaitMessage(ttl) {
|
||||
const minutesLeft = getWaitPeriod(ttl);
|
||||
if (minutesLeft <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const timeToWait = minutesLeft
|
||||
? `${minutesLeft} minute${minutesLeft > 1 ? 's' : ''}`
|
||||
: 'a few seconds';
|
||||
|
||||
return dedent`
|
||||
Please wait ${timeToWait} to resend an authentication link.
|
||||
`;
|
||||
}
|
||||
|
||||
export function getEncodedEmail(email) {
|
||||
if (!email) {
|
||||
return null;
|
||||
}
|
||||
return Buffer.from(email).toString('base64');
|
||||
}
|
||||
|
||||
export const decodeEmail = email => Buffer.from(email, 'base64').toString();
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"aboutUrl": "https://www.freecodecamp.org/about",
|
||||
"defaultProfileImage": "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png",
|
||||
"donateUrl": "https://www.freecodecamp.org/donate",
|
||||
"forumUrl": "https://forum.freecodecamp.org",
|
||||
"githubUrl": "https://github.com/freecodecamp/freecodecamp",
|
||||
"RSA": "https://forum.freecodecamp.org/t/the-read-search-ask-methodology-for-getting-unstuck/137307",
|
||||
"homeURL": "https://www.freecodecamp.org"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
const emptyProtector = {
|
||||
blocks: [],
|
||||
challenges: []
|
||||
};
|
||||
// protect against malformed map data
|
||||
// protect(block: { challenges: [], block: [] }|Void) => block|emptyProtector
|
||||
export default function protect(block) {
|
||||
// if no block or block has no challenges or blocks
|
||||
if (!block || !(block.challenges || block.blocks)) {
|
||||
return emptyProtector;
|
||||
}
|
||||
return block;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
export const alertTypes = _.keyBy(
|
||||
['success', 'info', 'warning', 'danger'],
|
||||
_.identity
|
||||
);
|
||||
|
||||
export const normalizeAlertType = alertType => alertTypes[alertType] || 'info';
|
||||
@@ -1,21 +0,0 @@
|
||||
import { pick } from 'lodash';
|
||||
|
||||
export {
|
||||
getEncodedEmail,
|
||||
decodeEmail,
|
||||
getWaitMessage,
|
||||
getWaitPeriod,
|
||||
renderEmailChangeEmail,
|
||||
renderSignUpEmail,
|
||||
renderSignInEmail
|
||||
} from './auth';
|
||||
|
||||
export const fixCompletedChallengeItem = obj =>
|
||||
pick(obj, [
|
||||
'id',
|
||||
'completedDate',
|
||||
'solution',
|
||||
'githubLink',
|
||||
'challengeType',
|
||||
'files'
|
||||
]);
|
||||
@@ -1,108 +0,0 @@
|
||||
const legacyFrontEndProjects = {
|
||||
challenges: [
|
||||
// build-a-personal-portfolio-webpage
|
||||
'bd7158d8c242eddfaeb5bd13',
|
||||
// build-a-random-quote-machine
|
||||
'bd7158d8c442eddfaeb5bd13',
|
||||
// build-a-25-5-clock
|
||||
'bd7158d8c442eddfaeb5bd0f',
|
||||
// build-a-javascript-calculator
|
||||
'bd7158d8c442eddfaeb5bd17',
|
||||
// show-the-local-weather
|
||||
'bd7158d8c442eddfaeb5bd10',
|
||||
// use-the-twitchtv-json-api
|
||||
'bd7158d8c442eddfaeb5bd1f',
|
||||
// stylize-stories-on-camper-news
|
||||
'bd7158d8c442eddfaeb5bd18',
|
||||
// build-a-wikipedia-viewer
|
||||
'bd7158d8c442eddfaeb5bd19',
|
||||
// build-a-tic-tac-toe-game
|
||||
'bd7158d8c442eedfaeb5bd1c',
|
||||
// build-a-simon-game
|
||||
'bd7158d8c442eddfaeb5bd1c'
|
||||
],
|
||||
title: 'Legacy Front End Projects',
|
||||
superBlock: 'legacy-front-end'
|
||||
};
|
||||
|
||||
const legacyBackEndProjects = {
|
||||
challenges: [
|
||||
// timestamp microservice
|
||||
'bd7158d8c443edefaeb5bdef',
|
||||
// request-header-parser-microservice
|
||||
'bd7158d8c443edefaeb5bdff',
|
||||
// url-shortener-microservice
|
||||
'bd7158d8c443edefaeb5bd0e',
|
||||
// image-search-abstraction-layer
|
||||
'bd7158d8c443edefaeb5bdee',
|
||||
// file-metadata-microservice
|
||||
'bd7158d8c443edefaeb5bd0f',
|
||||
// build-a-voting-app
|
||||
'bd7158d8c443eddfaeb5bdef',
|
||||
// build-a-nightlife-coordination-app
|
||||
'bd7158d8c443eddfaeb5bdff',
|
||||
// chart-the-stock-market
|
||||
'bd7158d8c443eddfaeb5bd0e',
|
||||
// manage-a-book-trading-club
|
||||
'bd7158d8c443eddfaeb5bd0f',
|
||||
// build-a-pinterest-clone
|
||||
'bd7158d8c443eddfaeb5bdee'
|
||||
],
|
||||
title: 'Legacy Back End Projects',
|
||||
superBlock: 'legacy-back-end'
|
||||
};
|
||||
|
||||
const legacyDataVisProjects = {
|
||||
challenges: [
|
||||
// build-a-markdown-previewer
|
||||
'bd7157d8c242eddfaeb5bd13',
|
||||
// build-a-camper-leaderboard
|
||||
'bd7156d8c242eddfaeb5bd13',
|
||||
// build-a-recipe-box
|
||||
'bd7155d8c242eddfaeb5bd13',
|
||||
// build-the-game-of-life
|
||||
'bd7154d8c242eddfaeb5bd13',
|
||||
// build-a-roguelike-dungeon-crawler-game
|
||||
'bd7153d8c242eddfaeb5bd13',
|
||||
// visualize-data-with-a-bar-chart
|
||||
'bd7168d8c242eddfaeb5bd13',
|
||||
// visualize-data-with-a-scatterplot-graph
|
||||
'bd7178d8c242eddfaeb5bd13',
|
||||
// visualize-data-with-a-heat-map
|
||||
'bd7188d8c242eddfaeb5bd13',
|
||||
// show-national-contiguity-with-a-force-directed-graph
|
||||
'bd7198d8c242eddfaeb5bd13',
|
||||
// map-data-across-the-globe
|
||||
'bd7108d8c242eddfaeb5bd13'
|
||||
],
|
||||
title: 'Legacy Data Visualization Projects',
|
||||
superBlock: 'legacy-data-visualization'
|
||||
};
|
||||
|
||||
const legacyInfosecQaProjects = {
|
||||
challenges: [
|
||||
// metric-imperial-converter
|
||||
'587d8249367417b2b2512c41',
|
||||
// issue-tracker
|
||||
'587d8249367417b2b2512c42',
|
||||
// personal-library
|
||||
'587d824a367417b2b2512c43',
|
||||
// stock-price-checker
|
||||
'587d824a367417b2b2512c44',
|
||||
// anonymous-message-board
|
||||
'587d824a367417b2b2512c45'
|
||||
],
|
||||
title: 'Legacy Information Security and Quality Assurance Projects',
|
||||
// Keep the settings page "Show Certification" button
|
||||
// pointing to information-security-and-quality-assurance
|
||||
superBlock: 'information-security-and-quality-assurance'
|
||||
};
|
||||
|
||||
const legacyProjects = [
|
||||
legacyFrontEndProjects,
|
||||
legacyBackEndProjects,
|
||||
legacyDataVisProjects,
|
||||
legacyInfosecQaProjects
|
||||
];
|
||||
|
||||
export default legacyProjects;
|
||||
@@ -1,9 +0,0 @@
|
||||
export const themes = {
|
||||
night: 'night',
|
||||
default: 'default'
|
||||
};
|
||||
|
||||
export const invertTheme = currentTheme =>
|
||||
!currentTheme || currentTheme === themes.default
|
||||
? themes.night
|
||||
: themes.default;
|
||||
Reference in New Issue
Block a user