-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Имаев Альберт #20
Имаев Альберт #20
Conversation
🍏 Пройден линтинг и базовые тесты |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍅
но в целом все хоршо
queries.js
Outdated
} | ||
|
||
getCheapSouvenirs(price) { | ||
// Данный метод должен возвращать все сувениры, цена которых меньше или равна price. | ||
return this.Souvenir.findAll({ | ||
where: { | ||
price: { [this.Op.lt]: price } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
цена должна мыть меньше или равна
primaryKey: true, | ||
autoIncrement: true | ||
}, | ||
name: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
кажется, что тут нужен индекс (в коде есть выборка по тэгу)
autoIncrement: true | ||
}, | ||
login: { | ||
type: DataTypes.TEXT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и тут индекс, уникальный (не может быть двух юзеров с одинаковым логином)
queries.js
Outdated
attributes: ['id', 'name', 'image', 'price', 'rating'], | ||
include: { | ||
model: this.Tag, | ||
where: { name: tag }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сравнение лучше делать регистронезависимым
queries.js
Outdated
}, | ||
include: [{ | ||
model: this.Country, | ||
where: { name: country }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и тут регистронезависимый
await souvenir.createReview(review, { transaction }); | ||
|
||
const reviews = await souvenir.getReviews({ transaction }); | ||
rating = (souvenir.rating * (reviews.length - 1) + rating) / (reviews.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не обязательно к исправлению
сейчас ты загружаешь в приложение весь список отзывов и обновляешь рейтинг
Такие вычисления лучше делать на стороне БД
queries.js
Outdated
}, | ||
{ | ||
model: this.User, | ||
where: { login } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже лучше регистронезависимое сравнение
🍏 Пройден линтинг и базовые тесты |
🍏 |
No description provided.