Working on the backend for an ecommerce application. Came across this schema for user model. If the user is seller then do we have to write the seller name again???
const userSchema = new mongoose.Schema({
name: { type: String, required: true },
age: { type: Number, required: true },
email: { type: String, required: true, unique: true },
address: { type: String, required: true },
password: { type: String, unique: true, required: true },
isAdmin: { type: Boolean, required: true, default: false },
isSeller: { type: Boolean, required: true, default: false },
seller: {
name: String,
rating: { type: Number, required: true, default: 0 },
numReviews: { type: Number, default: 0, required: true }
}
}, {
timestamps: true
});