Skip to content

Commit

Permalink
Added user.model.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Keagan Aromin authored and Keagan Aromin committed Jan 7, 2025
1 parent a1351c8 commit 8f59303
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions backend/models/user.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import mongoose from "mongoose";

const userSchema = new mongoose.Schema(
{
fullName: {
type: String,
required: true,
},
username: {
type: String,
required: true,
unique: true,
},
password: {
type: String,
required: true,
minlength: 6,
},
gender: {
type: String,
required: true,
enum: ["male", "female"],
},
profilePic: {
type: String,
default: "",
},
},
{ timestamps: true } // automatically adds createdAt and updatedAt to object, which are set to current time on document start and update
);

const User = mongoose.model("User", userSchema);

export default User;

0 comments on commit 8f59303

Please sign in to comment.