Skip to content

Commit 1780929

Browse files
updates
1 parent 0e3784d commit 1780929

File tree

8 files changed

+889
-15
lines changed

8 files changed

+889
-15
lines changed

.eslintrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"env": {
3+
"node": 1,
4+
"browser": 1
5+
},
6+
"globals": {
7+
"exampleGlobalVariable": true
8+
},
9+
"rules": {
10+
"eqeqeq": 1
11+
},
12+
"extends": "airbnb-base",
13+
"plugins": ["import"],
14+
"parserOptions": {
15+
"ecmaVersion": 6
16+
}
17+
}

.eslintrc.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": "eslint:recommended",
7+
"globals": {
8+
"Atomics": "readonly",
9+
"SharedArrayBuffer": "readonly"
10+
},
11+
"parserOptions": {
12+
"ecmaVersion": 2018,
13+
"sourceType": "module"
14+
},
15+
"rules": {
16+
}
17+
}

config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"development":{
33
"username": "root",
44
"password": null,
5-
"database": "test",
5+
"database": "crud",
66
"host": "127.0.0.1",
77
"dialect": "mysql"
88
},

controller/company.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ if(companyData === 1) {
2727
}
2828

2929
exports.update = async (req, res) => {
30+
console.log('req.body', req.body);
31+
3032
const companyId = req.body.id;
31-
const newData = { name: req.body.companyName };
32-
const updatedData = await CompanyModel.update(newData, {
33-
where: {id: companyId},
34-
plain: true});
35-
console.log('update', updatedData);
36-
if(companyData === 1) {
37-
return res.send('Record Updated Successfully');
38-
} else {
39-
return res.send('Record Not Updated');
40-
}
33+
const newData = { name: req.body.name };
34+
35+
await CompanyModel.update(newData, {
36+
where: {id: companyId}});
37+
38+
const userData = await CompanyModel.findAll({
39+
where: { id: companyId }
40+
});
41+
res.send(userData);
4142
}

models/company.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = (sequelize, DataTypes) => {
2-
var Company = sequelize.define('Company', {
2+
const Company = sequelize.define('Company', {
33
name: DataTypes.STRING
44
}, {});
55
Company.associate = function(models) {

models/employee.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = (sequelize, DataTypes) => {
2-
var Employee = sequelize.define('Employee', {
2+
const Employee = sequelize.define('Employee', {
33
name: {
44
type: DataTypes.STRING,
55
allowNull: false,

0 commit comments

Comments
 (0)