Skip to content

Commit

Permalink
authorization issue when connecting to mysql
Browse files Browse the repository at this point in the history
installed mysql to account for the throw error authorization
  • Loading branch information
rdevans87 committed May 29, 2021
1 parent c7cae8c commit bdc8944
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 32 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ run command `node employeeTracker`, then `npm start` to answer the prompts.
* Add departments, roles, employees
* View departments, roles, employees
* Update employee roles


## Submitted for review:

* The URL of the GitHub repository
Expand Down
31 changes: 15 additions & 16 deletions employeeTracker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// connect to db to perform quieries
const mysql = require('mysql');
const mysql = require('mysql2');
//calling database
const employeeTracker = require('./employeeTracker');
// interact with user via the command line
Expand Down Expand Up @@ -29,18 +29,18 @@ const connection = mysql.createConnection(

);

connection.connect((err) => {
if (err) throw err;
console.log(chalk.yellow.bold('==========================================================================='));
console.log(``);
console.log(chalk.red.bold(figlet.textSync('EMPLOYEE TRACKER SYSTEM')));
console.log(``);
console.log(` ` + chalk.green.bold('Created By: Ryan Evans'));
console.log(``);
console.log(chalk.yello.bold(`==============================================================================`));
menuPrompt();
// connection.connect((err) => {
// if (err) throw err;
// console.log(chalk.yellow.bold('==========================================================================='));
// console.log(``);
// console.log(chalk.red.bold(figlet.textSync('EMPLOYEE TRACKER SYSTEM')));
// console.log(``);
// console.log(` ` + chalk.green.bold('Created By: Ryan Evans'));
// console.log(``);
// console.log(chalk.yello.bold(`==============================================================================`));
// menuPrompt();

});
// });


const menuPrompt = () => {
Expand Down Expand Up @@ -254,7 +254,7 @@ const addNewEmployee = () => {
}

const addNewRole = () => {
connection.query('SELECT * FROM department', (err, department) => {
connection.query('SELECT * FROM department', (err, departments) => {
if (err) console.log(err);
departments = departments.map((department) => {
return {
Expand Down Expand Up @@ -288,9 +288,8 @@ const addNewRole = () => {
department_id: data.department.id,
},
function (err) {
if (err) throw err;
}

if (err) throw err;
},
);
console.log('New role added to database')
viewAllRoles();
Expand Down
16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,16 @@
// }


// const deleteCurrentEmployee = () => {
// const query = 'DELETE * FROM employee_table WHERE

// }

const deleteCurrentEmployee = () => {
const query = 'DELETE * FROM employee_table WHERE

}

const deleteCurrentRole = () => {
// const deleteCurrentRole = () => {

}
const deleteCurrentDepartment = () => {
// }
// const deleteCurrentDepartment = () => {

}
// }


113 changes: 109 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
},
"homepage": "https://github.com/rdevans87/MySQL-Employee-Tracker#readme",
"dependencies": {
"chalk": "^4.1.1",
"console.table": "^0.10.0",
"dotenv": "^10.0.0",
"figlet": "^1.5.0",
"inquirer": "^8.1.0",
"mysql": "^2.18.1"
"mysql": "^2.18.1",
"mysql2": "^2.2.5"
}
}

0 comments on commit bdc8944

Please sign in to comment.