mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
length validations
This commit is contained in:
@@ -6,6 +6,8 @@ const TodoSchema = Schema({
|
||||
text: {
|
||||
type: String,
|
||||
required: true,
|
||||
minLength: 1,
|
||||
maxLength: 300,
|
||||
},
|
||||
list: { type: Schema.Types.ObjectId, ref: 'TodoList', required: true },
|
||||
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
||||
|
||||
@@ -6,6 +6,8 @@ const TodoListSchema = Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
minLength: 1,
|
||||
maxLength: 100,
|
||||
},
|
||||
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
||||
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
||||
|
||||
@@ -13,6 +13,8 @@ const UserSchema = Schema({
|
||||
required: true,
|
||||
unique: true,
|
||||
validate: /^\S*$/,
|
||||
minLength: 3,
|
||||
maxLength: 50,
|
||||
},
|
||||
lists: [{ type: Schema.Types.ObjectId, ref: 'TodoList' }],
|
||||
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
||||
|
||||
Reference in New Issue
Block a user