-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
21 lines (19 loc) · 660 Bytes
/
schema.js
File metadata and controls
21 lines (19 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const Joi = require("joi");
const review = require("./models/review");
module.exports.listingSchema = Joi.object({
listing : Joi.object({
title : Joi.string().required(),
description : Joi.string().required(),
image : Joi.string().allow("", null),
price : Joi.number().required().min(0),
location : Joi.string().required(),
country : Joi.string().required(),
}).required(),
});
// This Schema for Review Section
module.exports.reviewSchema = Joi.object({
review : Joi.object({
rating : Joi.number().required().min(1).max(5),
comment : Joi.string().required(),
}).required(),
});