diff options
Diffstat (limited to 'backend/src/models')
| -rw-r--r-- | backend/src/models/user.model.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/backend/src/models/user.model.js b/backend/src/models/user.model.js new file mode 100644 index 0000000..6cb9476 --- /dev/null +++ b/backend/src/models/user.model.js @@ -0,0 +1,32 @@ +import mongoose, { Schema } from 'mongoose' + +const userSchema = new Schema( + { + username: { + type: String, + required: true, + unique: true, + lowercase: true, + trim: true, + minLength: 1, + maxLength: 30 + }, + + password: { + type: String, + required: true, + minLength: 8, + maxLength: 50 + }, + + email: { + type: String, + required: true, + unique: true, + lowercase: true, + trim: true, + } + } +) + +export const User = mongoose.model("User", userSchema)
\ No newline at end of file |
