Conversation
|
|
||
| const [row] = await auth.validateUser(req.body.login); | ||
|
|
||
| const dbUser = row[0]; // !!!!! |
There was a problem hiding this comment.
try to assign dbUser already, like const dbUser = await auth.validateUser(req.body.login)?.row[0]
|
|
||
| const dbUser = row[0]; // !!!!! | ||
|
|
||
| console.log("row:", row); |
There was a problem hiding this comment.
Here and in all pull request - remove console.log. They are needed only in development
|
|
||
| if (row.length > 0) { | ||
| let passwordEnteredByUser = req.body.pass; | ||
| let salt = row[0].salt; |
There was a problem hiding this comment.
Here and in all pull request - use const if variable will not be changed. If it's object - remember that properties could be changed in const
| if (bcrypt.hashSync(passwordEnteredByUser, salt) === row[0].crypto) { | ||
| if (bcrypt.hashSync(passwordEnteredByUser, salt) === dbUser.crypto) { | ||
|
|
||
| let user = {}; |
There was a problem hiding this comment.
const user = {}, const name = {} etc
| let idFixture = []; | ||
|
|
||
| for (let i = 1; i < req.body.length; i++) { | ||
| idFixture.push(req.body[i].idFixture); |
There was a problem hiding this comment.
see if you can use map, const idFixture = req.body.map(item => item.idFixture)
new_mvc_local/models/equipModel.js
Outdated
| let idF_1 = idFixture[0]; | ||
| let idF_2 = idFixture[1]; | ||
| let idF_3 = idFixture[2]; | ||
| let idF_4 = idFixture[3]; |
There was a problem hiding this comment.
looks better if it's const [idF_1, idF_2, idF_3, idF_4] = idFixture;
There was a problem hiding this comment.
Это временные вспомогательные переменные,я их уберу вообще нафиг)
new_mvc_local/models/equipModel.js
Outdated
| let query_4 = ""; | ||
|
|
||
| for (let i = 0; i < idFixture.length; i++) { | ||
| query_2 += " WHEN idFixture = '" + idFixture[i] + "' THEN " + idW; |
There was a problem hiding this comment.
try string literals, WHEN idFixture = '${dFixture[I]}' THEN ${idW}
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
new_mvc_local/models/equipModel.js
Outdated
|
|
||
| let query_3 = " END WHERE idFixture IN (" | ||
|
|
||
| let q = query_1 + query_2 + query_3 + query_4 + ")"; |
There was a problem hiding this comment.
same here, string literal style is better
new_mvc_local/models/equipModel.js
Outdated
| } | ||
| } | ||
|
|
||
| // static fixturesMovement() { |
|
|
||
| if (status.status === 200) { | ||
|
|
||
| // fixtureRow.push(req.body.idFixture); |
No description provided.