forked from Soujanya2004/wanderlust-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.js
More file actions
29 lines (26 loc) · 755 Bytes
/
validate.js
File metadata and controls
29 lines (26 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const joi=require('joi');
const reviews = require('./models/reviews');
module.exports.listingSchema=joi.object(
{
listing:joi.object(
{
title:joi.string().required(),
description:joi.string().required(),
country:joi.string().required(),
location:joi.string().required(),
price:joi.number().required().min(0),
image:joi.string().allow("",null),
}
).required(),
}
);
module.exports.reviewSchema=joi.object(
{
review:joi.object(
{
rating:joi.number().required().min(1).max(5),
comment:joi.string().required(),
}
).required(),
}
);