Skip to content

Commit

Permalink
feat(notification) - Integrate In-App and Email Notifications
Browse files Browse the repository at this point in the history
- Install required packages
- Implement events to aid seamless trigerring of events
- Write tests

Finishes #162414278
  • Loading branch information
ebzeal authored and jesseinit committed Jan 29, 2019
1 parent 3094143 commit 3f1c63e
Show file tree
Hide file tree
Showing 57 changed files with 1,158 additions and 800 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ package-lock.json

# dotenv file
.env
client

# personal files
swagger.1.yaml
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ node_js:
cache:
directories:
- node_modules
addons:
postgresql: '9.6'
services:
- postgresql
before_script:
Expand Down
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// import 'babel-polyfill';
import express from 'express';
import cors from 'cors';
import env from 'dotenv';
import volleyLogger from 'volleyball';
import expressValidator from 'express-validator';
import swaggerUi from 'swagger-ui-express';
import passport from 'passport';
Expand All @@ -11,13 +9,13 @@ import routes from './server/routes';
import googleStrategy from './server/config/passportConfigs/googleStrategy';
import facebookStrategy from './server/config/passportConfigs/facebookStragegy';
import linkedinStrategy from './server/config/passportConfigs/linkednStrategy';
import twitterStrategy from './server/config/passportConfigs/twitterStrategy';

env.config();
const swaggerDocument = YAML.load('swagger.yaml');
const app = express();

app.use(cors());
// app.use(volleyLogger);
app.use(expressValidator());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
Expand All @@ -28,6 +26,7 @@ app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
passport.use(googleStrategy);
passport.use(facebookStrategy);
passport.use(linkedinStrategy);
passport.use(twitterStrategy);
app.use(passport.initialize());

app.use('/api/v1', routes);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@
"passport-google-oauth20": "^1.0.0",
"passport-linkedin-oauth2": "^1.5.0",
"passport-local": "^1.0.0",
"passport-twitter": "^1.0.4",
"pg": "^7.7.1",
"pusher": "^2.2.0",
"randomstring": "^1.1.5",
"request": "^2.87.0",
"sequelize": "^4.42.0",
"sinon-chai": "^3.3.0",
"slug": "^0.9.3",
"swagger-ui-express": "^4.0.2",
"underscore": "^1.9.1",
Expand Down
1 change: 1 addition & 0 deletions server/config/passportConfigs/facebookStragegy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const facebookStrategy = new FacebookStrategy(
);

const mockStrategy = new MockStrategy('facebook', UserController.strategyCallback);
/* istanbul ignore next */
const facebook = process.env.NODE_ENV === 'test' ? mockStrategy : facebookStrategy;

export default facebook;
1 change: 1 addition & 0 deletions server/config/passportConfigs/googleStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const googleStrategy = new GoogleStrategy(
);

const mockStrategy = new MockStrategy('google', UserController.strategyCallback);
/* istanbul ignore next */
const google = process.env.NODE_ENV === 'test' ? mockStrategy : googleStrategy;

export default google;
1 change: 1 addition & 0 deletions server/config/passportConfigs/linkednStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const linkedinStrategy = new LinkedInStrategy(
);

const mockStrategy = new MockStrategy('linkedin', UserController.strategyCallback);
/* istanbul ignore next */
const linkedin = process.env.NODE_ENV === 'test' ? mockStrategy : linkedinStrategy;

export default linkedin;
22 changes: 22 additions & 0 deletions server/config/passportConfigs/twitterStrategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Strategy as TwitterStrategy } from 'passport-twitter';
import env from 'dotenv';
import UserController from '../../controllers/UserController';
import { MockStrategy } from '../../helpers/MockStrategy';

env.config();

const twitterStategy = new TwitterStrategy(
{
consumerKey: process.env.TWITTER_CLIENT_ID,
consumerSecret: process.env.TWITTER_CLIENT_SECRET,
callbackURL: 'http://localhost:3000/api/v1/auth/twitter/callback',
includeEmail: true
},
UserController.strategyCallback
);

const mockStrategy = new MockStrategy('twitter', UserController.strategyCallback);
/* istanbul ignore next */
const twitter = process.env.NODE_ENV === 'test' ? mockStrategy : twitterStategy;

export default twitter;
Loading

0 comments on commit 3f1c63e

Please sign in to comment.