webinterface/server/models/User.js

31 lines
626 B
JavaScript

const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,
unique: true,
trim: true
},
email: {
type: String,
required: true,
unique: true,
trim: true
},
password: {
type: String, // Wird davor zu einem Hash umgewandelt
required: true
},
createdAt: {
type: Date,
default: Date.now
},
isAdmin: {
type: Boolean,
default: false // Standardwert ist false
}
});
module.exports = mongoose.model('User', userSchema);