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: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
|
minLength: 1,
|
||||||
|
maxLength: 300,
|
||||||
},
|
},
|
||||||
list: { type: Schema.Types.ObjectId, ref: 'TodoList', required: true },
|
list: { type: Schema.Types.ObjectId, ref: 'TodoList', required: true },
|
||||||
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ const TodoListSchema = Schema({
|
|||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
|
minLength: 1,
|
||||||
|
maxLength: 100,
|
||||||
},
|
},
|
||||||
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
||||||
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
user: { type: Schema.Types.ObjectId, ref: 'User', required: true },
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ const UserSchema = Schema({
|
|||||||
required: true,
|
required: true,
|
||||||
unique: true,
|
unique: true,
|
||||||
validate: /^\S*$/,
|
validate: /^\S*$/,
|
||||||
|
minLength: 3,
|
||||||
|
maxLength: 50,
|
||||||
},
|
},
|
||||||
lists: [{ type: Schema.Types.ObjectId, ref: 'TodoList' }],
|
lists: [{ type: Schema.Types.ObjectId, ref: 'TodoList' }],
|
||||||
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
todos: [{ type: Schema.Types.ObjectId, ref: 'Todo' }],
|
||||||
|
|||||||
Reference in New Issue
Block a user