brainlet/models/User.js

14 lines
303 B
JavaScript
Raw Normal View History

2020-10-05 20:36:03 +03:00
const mongoose = require('mongoose');
const User = mongoose.model('User', {
username: String,
password: String,
email: String,
role: String
});
User.findByUsername = async function(username) {
return await User.findOne({ username }).exec();
};
module.exports = User;