Skip to content

Commit

Permalink
Merge pull request #49 from andela/ch-inapp-notification-setup-168365057
Browse files Browse the repository at this point in the history
#168365057 Implementation of a reusable in-App notification module
  • Loading branch information
chukwuemekachm committed Sep 10, 2019
2 parents 6b9a1d8 + 0f91054 commit ee82a90
Show file tree
Hide file tree
Showing 23 changed files with 463 additions and 163 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"lint": "eslint --fix \"./src/**/*.js\"",
"pretest": "cross-env NODE_ENV=test npm run db:migrate:all",
"test": "cross-env NODE_ENV=test nyc mocha --no-timeout './tests/index.js' --exit",
"test1": "cross-env NODE_ENV=test nyc mocha --no-timeout './tests/index.js' --exit",
"test:report": "cross-env NODE_ENV=test npm run db:migrate:all && cross-env NODE_ENV=test nyc mocha --timeout 5000 './tests/*.js' --exit",
"dev": "nodemon --exec babel-node src/index.js",
"start": "npm run build && node build/index.js",
Expand Down Expand Up @@ -42,14 +43,13 @@
"@babel/node": "^7.5.5",
"@babel/plugin-transform-regenerator": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"@babel/runtime": "^7.4.5",
"babel-eslint": "^10.0.2",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"cors": "^2.8.4",
"cors": "^2.8.5",
"coveralls": "^3.0.6",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
Expand All @@ -64,13 +64,15 @@
},
"nyc": {
"exclude": [
"test/mock.data.js",
"src/config/index.js",
"src/services/socialOAuth.js",
"src/models/index.js",
"src/routes/index.js",
"src/repositories/UserRepository.js",
"public",
"node_modules"
"node_modules",
"src/controllers/ExampleUserNotificationController.js"
],
"reporter": ["lcov", "text"],
"cache": false,
Expand Down
74 changes: 47 additions & 27 deletions public/docs/swaggerDoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"basePath": "/api/v1",
"basePath": "/",
"securityDefinitions": {
"bearerAuth": {
"type": "apiKey",
Expand Down Expand Up @@ -62,7 +62,7 @@
}
}
},
"/auth/signin": {
"/api/v1/auth/signin": {
"post": {
"tags": ["User"],
"summary": "Logs user into the system",
Expand Down Expand Up @@ -135,7 +135,7 @@
}
}
},
"/auth/signup": {
"/api/v1/auth/signup": {
"post": {
"summary": "user signup",
"tags": ["User"],
Expand Down Expand Up @@ -217,11 +217,22 @@
},
"description": "",
"headers": {}
},
"409": {
"schema": {
"title": "Success",
"example": {
"status": "error",
"error": "User {user_email} already exists"
}
},
"description": "",
"headers": {}
}
}
}
},
"/user": {
"/api/v1/user": {
"get": {
"description": "Endpoint to enable users view profile details",
"summary": "View profile details",
Expand Down Expand Up @@ -369,25 +380,23 @@
"example": {
"status": "success",
"data": {
"uuid": "2d33e804-8326-41bf-96d6-2501525bef12",
"email": "wokorosamudel@yahoo.com",
"password": "Samsizzy199",
"name": "Wokoro Douye Samuel",
"role": "manager",
"is_verified": false,
"facebook_id": null,
"google_id": null,
"manager_id": null,
"office_id": null,
"gender": "male",
"date_of_birth": "1993-27-3",
"department": null,
"preferred_currency": "Naira",
"preferred_language": "English",
"residential_address": "No. 32 Arizonal street yenezuegene yenegoa",
"image_url": "/url/path/filename",
"createdAt": "2019-09-01T15:46:59.418Z",
"updatedAt": "2019-09-02T20:52:47.056Z"
"uuid": "f474d708-1baa-47a9-ab47-f9a31832d768",
"email": "wokorossamuel@yahoo.com",
"name": "Wokoro Douye Samuel",
"role": "manager",
"is_verified": false,
"facebook_id": "",
"google_id": "",
"gender": "male",
"image_url": "",
"date_of_birth": null,
"department": null,
"preferred_currency": null,
"preferred_language": null,
"residential_address": null,
"createdAt": "2019-09-09T16:24:53.014Z",
"updatedAt": "2019-09-09T16:24:53.014Z",
"manager_uuid": null
}
}
},
Expand Down Expand Up @@ -415,11 +424,22 @@
}
}
}
},
"409": {
"description": "",
"schema": {
"example": {
"application/json; charset=utf-8": {
"status": "error",
"error": "User {user_email} already exists"
}
}
}
}
}
}
},
"/auth/forgotPassword": {
"/api/v1/auth/forgotPassword": {
"post": {
"tags": [
"User"
Expand Down Expand Up @@ -447,7 +467,7 @@
}
}
},
"/auth/resetPassword/:uuid/:token": {
"/api/v1/auth/resetPassword/:uuid/:token": {
"put": {
"tags": [
"Authentication"
Expand Down Expand Up @@ -475,7 +495,7 @@
}
}
},
"/trip_request": {
"/api/v1/trip_request": {
"post": {
"tags": ["tripRequest"],
"summary": "Allow users to create a return trip",
Expand Down Expand Up @@ -508,7 +528,7 @@
}
}
},
"/trips": {
"/api/v1/trips": {
"post": {
"tags": ["Trip"],
"summary": "Allow users to create a return trip",
Expand Down
3 changes: 3 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import express from 'express';
import bodyParser from 'body-parser';
import cors from 'cors';
import route from './routes';

const app = express();

app.use(cors({ credentials: true, origin: true }));

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

Expand Down
32 changes: 16 additions & 16 deletions src/controllers/AdminController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { inValidEmail } from '../modules/validator';
class AdminController {
/**
* @description Assign roles to users
*
*
* @param {*} req - Request Object
*
*
* @param {*} res - Response Object
*
*
* @returns {object} - returns a response object
*
*
* @memberof AdminController
*/
async assignRole(req, res) {
Expand All @@ -36,13 +36,13 @@ class AdminController {

/**
* @description gets a list of all users
*
*
* @param {object} req - request object
*
*
* @param {object} res - response object
*
*
* @returns {object} returns a response object
*
*
* @memberof AdminController
*/
async getUsers(req, res) {
Expand All @@ -62,13 +62,13 @@ class AdminController {

/**
* @description gets a user by uuid
*
*
* @param {object} req request object
*
*
* @param {object} res response object
*
*
* @returns {object} returns a response containing the user object
*
*
* @memberof AdminController
*/
async getUser(req, res) {
Expand All @@ -86,13 +86,13 @@ class AdminController {

/**
* @description assigns permissions to role
*
*
* @param {object} req request object
*
*
* @param {object} res response object
*
*
* @returns {object} returns a response containing the user object
*
*
* @memberof AdminController
*/
async assignPermission(req, res) {
Expand Down
Loading

0 comments on commit ee82a90

Please sign in to comment.