Skip to content

Commit 8517bfe

Browse files
Merge pull request #5345 from topcoder-platform/gsheet-contentful
Gsheet contentful
2 parents 719c10b + 4857f16 commit 8517bfe

File tree

18 files changed

+675
-11
lines changed

18 files changed

+675
-11
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ workflows:
282282
filters:
283283
branches:
284284
only:
285-
- email-pref-revamp
285+
- free
286286
# This is alternate dev env for parallel testing
287287
- "build-qa":
288288
context : org-global

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ ARG TC_M2M_AUTH0_URL
6565
ARG AUTH_SECRET
6666

6767
ARG COMMUNITY_APP_URL
68+
ARG GSHEETS_API_KEY
6869

6970
################################################################################
7071
# Setting of environment variables in the Docker image.
@@ -120,6 +121,7 @@ ENV CONTENTFUL_EDU_CDN_API_KEY=$CONTENTFUL_EDU_CDN_API_KEY
120121
ENV CONTENTFUL_EDU_PREVIEW_API_KEY=$CONTENTFUL_EDU_PREVIEW_API_KEY
121122
ENV RECRUITCRM_API_KEY=$RECRUITCRM_API_KEY
122123
ENV COMMUNITY_APP_URL=$COMMUNITY_APP_URL
124+
ENV GSHEETS_API_KEY=$GSHEETS_API_KEY
123125

124126
################################################################################
125127
# Testing and build of the application inside the container.

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ docker build -t $TAG \
4444
--build-arg CONTENTFUL_COMCAST_CDN_API_KEY=$CONTENTFUL_COMCAST_CDN_API_KEY \
4545
--build-arg CONTENTFUL_COMCAST_PREVIEW_API_KEY=$CONTENTFUL_COMCAST_PREVIEW_API_KEY \
4646
--build-arg RECRUITCRM_API_KEY=$RECRUITCRM_API_KEY \
47+
--build-arg GSHEETS_API_KEY=$GSHEETS_API_KEY \
4748
--build-arg COMMUNITY_APP_URL=$COMMUNITY_APP_URL .
4849

4950
# Copies "node_modules" from the created image, if necessary for caching.

config/custom-environment-variables.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ module.exports = {
104104
AUTH0_PROXY_SERVER_URL: 'TC_M2M_AUTH0_PROXY_SERVER_URL',
105105
TOKEN_CACHE_TIME: 'TOKEN_CACHE_TIME',
106106
},
107+
GSHEETS_API_KEY: 'GSHEETS_API_KEY',
107108
};

config/default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ module.exports = {
249249
RECRUITCRM_API_KEY: '',
250250
},
251251

252+
GSHEETS_API_KEY: 'AIzaSyBRdKySN5JNCb2H6ZxJdTTvp3cWU51jiOQ',
253+
252254
AUTH_CONFIG: {
253255
AUTH0_URL: 'TC_M2M_AUTH0_URL',
254256
AUTH0_AUDIENCE: 'TC_M2M_AUDIENCE',

package-lock.json

Lines changed: 179 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"flag-icon-css": "^3.3.0",
6666
"focus-trap-react": "^6.0.0",
6767
"form-data": "^3.0.0",
68+
"google-spreadsheet": "^3.1.15",
6869
"helmet": "^3.12.1",
6970
"highlight.js": "^9.18.1",
7071
"html-to-text": "^5.1.1",

src/server/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import mailChimpRouter from './routes/mailchimp';
2828
import mockDocuSignFactory from './__mocks__/docu-sign-mock';
2929
import recruitCRMRouter from './routes/recruitCRM';
3030
import mmLeaderboardRouter from './routes/mmLeaderboard';
31+
import gSheetsRouter from './routes/gSheet';
3132

3233
/* Dome API for topcoder communities */
3334
import tcCommunitiesDemoApi from './tc-communities';
@@ -137,6 +138,7 @@ async function onExpressJsSetup(server) {
137138
server.use('/api/mailchimp', mailChimpRouter);
138139
server.use('/api/recruit', recruitCRMRouter);
139140
server.use('/api/mml', mmLeaderboardRouter);
141+
server.use('/api/gsheets', gSheetsRouter);
140142

141143
// serve demo api
142144
server.use(

src/server/routes/gSheet.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* The routes related to GSheets integration
3+
*/
4+
5+
import express from 'express';
6+
import GSheetService from '../services/gSheet';
7+
8+
const cors = require('cors');
9+
10+
const routes = express.Router();
11+
12+
// Enables CORS on those routes according config above
13+
// ToDo configure CORS for set of our trusted domains
14+
routes.use(cors());
15+
routes.options('*', cors());
16+
17+
routes.get('/:id', (req, res) => new GSheetService().getSheet(req, res));
18+
19+
export default routes;

0 commit comments

Comments
 (0)