mirror of
https://github.com/yusufipk/RememberMe.git
synced 2026-09-11 10:56:07 +00:00
changed some lines to be compaitable with rememberme-cli
This commit is contained in:
+43
-61
@@ -4,68 +4,55 @@ const Joi = require("joi");
|
||||
const personSchema = new mongoose.Schema({
|
||||
name: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
trim: true,
|
||||
required: true,
|
||||
},
|
||||
metAt: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
required: true,
|
||||
},
|
||||
place: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
},
|
||||
contact: {
|
||||
type: new mongoose.Schema({
|
||||
phone: {
|
||||
phone: {
|
||||
type: String,
|
||||
maxlength: 20,
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
maxlength: 255,
|
||||
},
|
||||
socialmedia: {
|
||||
instagram: {
|
||||
type: String,
|
||||
minlength: 5,
|
||||
maxlength: 20,
|
||||
maxlength: 15,
|
||||
unqiue: true,
|
||||
},
|
||||
email: {
|
||||
youtube: {
|
||||
type: String,
|
||||
minlength: 5,
|
||||
maxlength: 255,
|
||||
maxlength: 15,
|
||||
},
|
||||
socialmedia: {
|
||||
type: new mongoose.Schema({
|
||||
instagram: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 15,
|
||||
unqiue: true,
|
||||
},
|
||||
youtube: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 15,
|
||||
},
|
||||
twitter: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 15,
|
||||
},
|
||||
}),
|
||||
},
|
||||
website: {
|
||||
twitter: {
|
||||
type: String,
|
||||
minlength: 5,
|
||||
maxlength: 25,
|
||||
maxlength: 15,
|
||||
},
|
||||
}),
|
||||
},
|
||||
website: {
|
||||
type: String,
|
||||
maxlength: 25,
|
||||
},
|
||||
},
|
||||
birth: {
|
||||
type: String,
|
||||
maxlength: 25,
|
||||
},
|
||||
age: {
|
||||
type: Number,
|
||||
maxlength: 100,
|
||||
type: String,
|
||||
maxlength: 2,
|
||||
},
|
||||
likes: {
|
||||
type: [String],
|
||||
@@ -75,22 +62,18 @@ const personSchema = new mongoose.Schema({
|
||||
},
|
||||
occupation: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
},
|
||||
lastseen: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
},
|
||||
nextcontact: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 50,
|
||||
},
|
||||
notes: {
|
||||
type: String,
|
||||
minlength: 3,
|
||||
maxlength: 500,
|
||||
},
|
||||
tags: {
|
||||
@@ -105,8 +88,7 @@ const personSchema = new mongoose.Schema({
|
||||
},
|
||||
createdAt: {
|
||||
type: String,
|
||||
maxlength: 25,
|
||||
required: true,
|
||||
maxlength: 30,
|
||||
},
|
||||
editedAt: {
|
||||
type: Date,
|
||||
@@ -119,29 +101,29 @@ const Person = mongoose.model("Person", personSchema);
|
||||
|
||||
function validatePerson(value) {
|
||||
const schema = Joi.object({
|
||||
name: Joi.string().min(3).max(50).required(),
|
||||
metAt: Joi.string().min(3).max(50).required(),
|
||||
place: Joi.string().min(3).max(50),
|
||||
name: Joi.string().max(50).required(),
|
||||
metAt: Joi.string().max(50).required(),
|
||||
place: Joi.string().allow("").max(50),
|
||||
contact: Joi.object({
|
||||
phone: Joi.string().min(5).max(20),
|
||||
email: Joi.string().email().min(5).max(255),
|
||||
phone: Joi.string().allow("").max(20),
|
||||
email: Joi.string().allow("").email().max(255),
|
||||
socialmedia: Joi.object({
|
||||
instagram: Joi.string().min(3).max(15),
|
||||
youtube: Joi.string().min(3).max(15),
|
||||
twitter: Joi.string().min(3).max(15),
|
||||
instagram: Joi.string().allow("").max(15),
|
||||
youtube: Joi.string().allow("").max(15),
|
||||
twitter: Joi.string().allow("").max(15),
|
||||
}),
|
||||
website: Joi.string().min(5).max(25),
|
||||
website: Joi.string().allow("").max(25),
|
||||
}),
|
||||
birth: Joi.string().max(25),
|
||||
age: Joi.number().max(100),
|
||||
likes: Joi.array(),
|
||||
dislikes: Joi.array(),
|
||||
occupation: Joi.string().min(3).max(50),
|
||||
lastseen: Joi.string().min(3).max(50),
|
||||
nextcontact: Joi.string().min(3).max(50),
|
||||
notes: Joi.string().min(3).max(500),
|
||||
tags: Joi.array().max(6),
|
||||
createdAt: Joi.string().max(25).required(),
|
||||
birth: Joi.string().allow("").max(25),
|
||||
age: Joi.string().allow("").max(100),
|
||||
likes: Joi.array().allow(""),
|
||||
dislikes: Joi.array().allow(""),
|
||||
occupation: Joi.string().allow("").max(50),
|
||||
lastseen: Joi.string().allow("").max(50),
|
||||
nextcontact: Joi.string().allow("").max(50),
|
||||
notes: Joi.string().allow("").max(500),
|
||||
tags: Joi.array().allow("").max(6),
|
||||
createdAt: Joi.string().allow("").max(30),
|
||||
});
|
||||
return schema.validate(value, { allowUnknown: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user