-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
36 lines (34 loc) · 981 Bytes
/
Copy pathschema.js
File metadata and controls
36 lines (34 loc) · 981 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
30
31
32
33
34
35
36
const Joi = require('joi');
// Listing Schema
module.exports.listingSchema = Joi.object({
listing: Joi.object({
title: Joi.string().required(),
description: Joi.string().required(),
location: Joi.string().required(),
country: Joi.string().required(),
price: Joi.number().required().min(0),
image: Joi.string().allow("", null),
category: Joi.string()
.valid(
'trending',
'rooms',
'iconic',
'mountains',
'castles',
'pools',
'camping',
'farms',
'arctic',
'domes',
'boats'
)
.required()
}).required()
});
// Review Schema
module.exports.reviewSchema = Joi.object({
review: Joi.object({
rating: Joi.number().required().min(1).max(5),
comment: Joi.string().required()
}).required()
});