mirror of
https://github.com/Alvin-Zilverstand/challenge-11.git
synced 2026-03-06 11:06:21 +01:00
24 lines
409 B
JavaScript
24 lines
409 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
const userSchema = new mongoose.Schema({
|
|
username: {
|
|
type: String,
|
|
required: true,
|
|
unique: true
|
|
},
|
|
password: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
role: {
|
|
type: String,
|
|
enum: ['admin', 'staff'],
|
|
default: 'staff'
|
|
},
|
|
createdAt: {
|
|
type: Date,
|
|
default: Date.now
|
|
}
|
|
});
|
|
|
|
module.exports = mongoose.model('User', userSchema);
|