Skip to content

Commit

Permalink
fixed mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Julia Khabibova committed Oct 29, 2023
1 parent 1365c1b commit f2b49da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const limiter = rateLimit({
max: 100,
});

app.use(limiter);

app.use(helmet());

app.use(express.json());
Expand All @@ -29,6 +27,8 @@ mongoose.connect(DB_URL);

app.use(requestLogger);

app.use(limiter);

app.use('/', require('./routes/index'));

app.use(errorLogger);
Expand Down
5 changes: 1 addition & 4 deletions backend/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ const userSchema = new mongoose.Schema({
name: {
type: String,
default: 'Жак-Ив Кусто',
required: [true, 'Поле должно быть заполнено'],
minlength: [2, 'Минимально количесвто символов - 2'],
maxlength: [30, 'Максимальное количесвто символов - 30'],
},
about: {
type: String,
default: 'Исследователь',
required: [true, 'Поле должно быть заполнено'],
minlength: [2, 'Минимально количесвто символов - 2'],
maxlength: [30, 'Максимальное количесвто символов - 30'],
},
avatar: {
type: String,
default: 'https://pictures.s3.yandex.net/resources/jacques-cousteau_1604399756.png',
required: [true, 'Поле должно быть заполнено'],
validate: {
validator(url) {
return urlRegex.test(url);
Expand All @@ -35,7 +32,7 @@ const userSchema = new mongoose.Schema({
unique: true,
validate: {
validator(email) {
emailRegex.test(email);
return emailRegex.test(email);
},
message: 'Введите верный email',
},
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ router.post('/', celebrate({
avatar: Joi.string().pattern(urlRegex),
email: Joi.string().required().pattern(emailRegex),
password: Joi.string().required(),
}).unknown(true),
}),
}), addUser);

module.exports = router;

0 comments on commit f2b49da

Please sign in to comment.