File tree Expand file tree Collapse file tree 8 files changed +889
-15
lines changed Expand file tree Collapse file tree 8 files changed +889
-15
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 22 "development" :{
33 "username" : " root" ,
44 "password" : null ,
5- "database" : " test " ,
5+ "database" : " crud " ,
66 "host" : " 127.0.0.1" ,
77 "dialect" : " mysql"
88 },
Original file line number Diff line number Diff line change @@ -27,15 +27,16 @@ if(companyData === 1) {
2727}
2828
2929exports . 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}
Original file line number Diff line number Diff line change 11module . 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 ) {
Original file line number Diff line number Diff line change 11module . exports = ( sequelize , DataTypes ) => {
2- var Employee = sequelize . define ( 'Employee' , {
2+ const Employee = sequelize . define ( 'Employee' , {
33 name : {
44 type : DataTypes . STRING ,
55 allowNull : false ,
You can’t perform that action at this time.
0 commit comments