Skip to content

feat: - add telegram data validation#172

Open
saniok017 wants to merge 2 commits into
share-n-coffee:processfrom
saniok017:process
Open

feat: - add telegram data validation#172
saniok017 wants to merge 2 commits into
share-n-coffee:processfrom
saniok017:process

Conversation

@saniok017

Copy link
Copy Markdown
Collaborator

check if data is from the telegram

Comment thread server/lib/dataValidation.js Outdated
}
if (+new Date() - user.auth_date > 86400) {

if (+new Date() / 1000 - user.auth_date > 86400) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

86400 претендует на константу или даже сеттинг

Comment thread server/api/apiAuth.js Outdated
})
.catch(err => console.log(err));
});
let { department } = user || null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| null избыточен, так как если department нету в user то он будет undefined что вполне ожидаемо так как undefined именно вычисляемый тип, по сути department мы вычисляем а не декларируем со значением по умолчанию null

Comment thread server/api/apiAuth.js Outdated
.all(dataValidation)
.post((req, res) => {
const reqUser = req.body;
const DBController = new ClassDBController('user', 'department');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В этом месте лучше подойдет нэйминг вида userDBController вместо DBController так далее в программе будет понятней что мы оперируем не каким то супер контролером всех сущностей

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше использовать развернутое описание

userDepartmentDBController

или достаточно

userDBController ❓

@saniok017

Copy link
Copy Markdown
Collaborator Author

Благодарю 🙇

@saniok017 saniok017 requested a review from artur-code June 16, 2019 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants