change(readme) update readme and some changes to database

This commit is contained in:
Yusuf İpek
2021-07-25 12:56:57 +03:00
parent 53694ac883
commit 408cec0c01
5 changed files with 97 additions and 14 deletions
+10 -3
View File
@@ -9,12 +9,17 @@ const personSchema = new mongoose.Schema({
trim: true,
required: true,
},
place: {
metAt: {
type: String,
minlength: 3,
maxlength: 50,
required: true,
},
place: {
type: String,
minlength: 3,
maxlength: 50,
},
contact: {
type: new mongoose.Schema({
phone: {
@@ -101,6 +106,7 @@ const personSchema = new mongoose.Schema({
createdAt: {
type: String,
maxlength: 25,
required: true,
},
editedAt: {
type: Date,
@@ -114,7 +120,8 @@ const Person = mongoose.model("Person", personSchema);
function validatePerson(value) {
const schema = Joi.object({
name: Joi.string().min(3).max(50).required(),
place: Joi.string().min(3).max(50).required(),
metAt: Joi.string().min(3).max(50).required(),
place: Joi.string().min(3).max(50),
contact: Joi.object({
phone: Joi.string().min(5).max(20),
email: Joi.string().email().min(5).max(255),
@@ -134,7 +141,7 @@ function validatePerson(value) {
nextcontact: Joi.string().min(3).max(50),
notes: Joi.string().min(3).max(500),
tags: Joi.array().max(6),
createdAt: Joi.string().max(25),
createdAt: Joi.string().max(25).required(),
});
return schema.validate(value, { allowUnknown: true });
}