summaryrefslogtreecommitdiff
path: root/backend/src/models/user.model.js
blob: 6cb94765c5a22bb5c50e3b3cfb0bbb00f3ab47ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)