Skip to content

Commit 5dec141

Browse files
authored
Merge pull request #94 from open-source-labs/dev
Updated formatting and Volume History component
2 parents 12020cd + da50fb6 commit 5dec141

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+646
-797
lines changed

server/controllers/apiController.js

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* ************************************
3-
*
42
* @module API Controller
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that sends emails to user for container issues and signup information
8-
*
9-
* ************************************
104
*/
11-
125
const nodemailer = require('nodemailer');
136
const email = require('../../security/email');
147

@@ -27,26 +20,27 @@ const transporter = nodemailer.createTransport({
2720

2821
// sends notification email when container issue occurs
2922
apiController.sendEmailAlert = (req, res, next) => {
30-
3123
const { email, containerName, time, date, stopped } = req.body;
3224
let emailBody;
3325

3426
if (stopped === 'true') {
35-
emailBody = ` <h2>Alert: ${containerName} has stopped!</h2>
36-
<h3>Container <b>${containerName}</b> stopped running at <b>${time}</b> on <b>${date}</b>.</h3>
37-
<p>Please login to Docketeer for more details.</p>
38-
<br />
39-
<p>Warmest regards,</p>
40-
<p>Team Docketeer</p> `;
27+
emailBody = `
28+
<h2>Alert: ${containerName} has stopped!</h2>
29+
<h3>Container <b>${containerName}</b> stopped running at <b>${time}</b> on <b>${date}</b>.</h3>
30+
<p>Please login to Docketeer for more details.</p>
31+
<br />
32+
<p>Warmest regards,</p>
33+
<p>Team Docketeer</p> `;
4134
} else {
4235
const { percent, type, threshold } = req.body;
43-
emailBody = ` <h2>Alert: ${containerName} has breached the ${type} threshold!</h2>
44-
<h3>Container <b>${containerName}</b> used <b>${percent}%<b> ${type} at <b>${time}</b> on <b>${date}</b>.</h3>
45-
<p>This exceeds the ${type} threshold of ${threshold}%.</p>
46-
<p>Please login to Docketeer for more details.</p>
47-
<br />
48-
<p>Warmest regards,</p>
49-
<p>Team Docketeer</p> `;
36+
emailBody = `
37+
<h2>Alert: ${containerName} has breached the ${type} threshold!</h2>
38+
<h3>Container <b>${containerName}</b> used <b>${percent}%<b> ${type} at <b>${time}</b> on <b>${date}</b>.</h3>
39+
<p>This exceeds the ${type} threshold of ${threshold}%.</p>
40+
<p>Please login to Docketeer for more details.</p>
41+
<br />
42+
<p>Warmest regards,</p>
43+
<p>Team Docketeer</p> `;
5044
}
5145

5246
const mailDetails = {
@@ -77,14 +71,15 @@ apiController.signupEmail = (req, res, next) => {
7771
7872
to: email,
7973
subject: 'Docketeer: Account Details',
80-
html: `<h1>Welcome to Docketeer</h1>
81-
<p>We are so excited to have you onboard!</p>
82-
<h3>Username: ${username}</h3>
83-
<h3>Password: ${password}</h3>
84-
<p>For any questions or concerns, please reach out to us at [email protected].</p>
85-
<br/>
86-
<p>Warmest regards,</p>
87-
<p>Team Docketeer</p>`
74+
html:`
75+
<h1>Welcome to Docketeer</h1>
76+
<p>We are so excited to have you onboard!</p>
77+
<h3>Username: ${username}</h3>
78+
<h3>Password: ${password}</h3>
79+
<p>For any questions or concerns, please reach out to us at [email protected].</p>
80+
<br/>
81+
<p>Warmest regards,</p>
82+
<p>Team Docketeer</p>`
8883
};
8984

9085
transporter.sendMail(mailDetails)

server/controllers/bcryptController.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* ************************************
3-
*
42
* @module Bcrypt Controller
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that encrypts password before storing in database and compares a user's inputted password to their stored password
8-
*
9-
* ************************************
104
*/
11-
125
const db = require('../models/cloudModel');
136
const bcrypt = require('bcryptjs');
147

server/controllers/configController.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/**
2-
* ************************************
3-
*
42
* @module ConfigController
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that updates a user's contact preference, CPU threshold, memory threshold, and container stop preference in database
8-
*
9-
* ************************************
104
*/
115

126
const db = require('../models/cloudModel');

server/controllers/cookieController.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/**
2-
* ************************************
3-
*
42
* @module Cookie Controller
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that stores the user id in a HTTP-only cookie and sets HTTP-only cookie specifically for admins
8-
*
9-
* ************************************
104
*/
115

126
const cookieController = {};
@@ -31,6 +25,7 @@ cookieController.setAdminCookie = (req, res, next) => {
3125
}
3226
if (role_id === 2) {
3327
res.cookie('adminType', 'admin', { httpOnly: true });
28+
res.locals.cookie = 'admin';
3429
}
3530

3631
return next();

server/controllers/dbController.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/**
2-
* ************************************
3-
*
42
* @module Database Controller
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that checks if the database has a user table and creates one if it doesn't
8-
*
9-
* ************************************
104
*/
115

126
const db = require('../models/cloudModel');

server/controllers/signupController.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
/**
2-
* ************************************
3-
*
42
* @module Signup Controller
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that checks if username exists, if password meets requirements upon signup, and if the login form is missing a username or password
8-
*
9-
* ************************************
104
*/
115

126
const db = require('../models/cloudModel');

server/controllers/userController.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* ************************************
3-
*
42
* @module UserController
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Contains middleware that creates new user in database, gets all users from database for system admin, and verifies user exists before sending back user data to login component
8-
*
9-
* ************************************
104
*/
11-
125
const db = require('../models/cloudModel');
136

147
const userController = {};

server/models/cloudModel.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
/**
2-
* ************************************
3-
*
4-
* @module Cloud Database Model
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
7-
* @description Creates pool to connect application with elephantSQL cloud database that contains persisted user information, exports function used to query database
8-
*
9-
* ************************************
10-
*/
11-
121
const { Pool } = require('pg');
13-
14-
152
require('dotenv').config();
163

17-
// Mo need to create any tables, upon start up Docketeer will create those tables in your DB instance automatically.
184
const PG_URI = process.env.POSTGRES_URI;
19-
20-
// // Connects to database.
21-
// // Note: no need to create any tables, upon start up Docketeer will create those tables in your DB instance automatically.
5+
// Note: no need to create any tables, upon start up Docketeer will create those tables in your DB instance automatically.
226

237
const cloudPool = new Pool({
248
connectionString: PG_URI,

server/routes/accountRouter.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* ************************************
3-
*
42
* @module AccountRouter
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Routes all requests to change user information
8-
*
9-
* ************************************
104
*/
11-
125
const express = require('express');
136
const configController = require('../controllers/configController');
147
const userController = require('../controllers/userController');

server/routes/adminRouter.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
/**
2-
* ************************************
3-
*
42
* @module AdminRouter
5-
* @author Brent Speight, Emma Czech, May Li, Ricardo Cortez
6-
* @date 08/02/2021
73
* @description Routes all requests to admin endpoint
8-
*
9-
* ************************************
104
*/
11-
125
const express = require('express');
136
const userController = require('../controllers/userController');
147

0 commit comments

Comments
 (0)