Last active
May 11, 2016 15:42
-
-
Save czbaker/c8376da8546f721bedbfb633b4d890ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Mongoose, { Schema } from 'mongoose'; | |
| import Random from 'random-js'; | |
| // Random Interface | |
| const r = new Random(Random.engines.mt19937().autoSeed()); | |
| // User Schema | |
| const UserSchema = new Schema({ | |
| id: { type: String, required: true, default: r.string(20) }, | |
| username: { type: String, required: true }, | |
| email: { type: String, required: true, lowercase: true }, | |
| salt: { type: String, required: true }, | |
| password: { type: String, required: true }, | |
| roles: { type: [String], required: true }, | |
| }); | |
| export const User = Mongoose.model('User', UserSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment