Advertisement
Guest User

Untitled

a guest
May 11th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import Mongoose, { Schema } from 'mongoose';
  2. import Random from 'random-js';
  3.  
  4. // Random Interface
  5. const r = new Random(Random.engines.mt19937().autoSeed());
  6.  
  7. // User Schema
  8. const UserSchema = new Schema({
  9. id: { type: String, required: true, default: r.string(20) },
  10. username: { type: String, required: true },
  11. email: { type: String, required: true, lowercase: true },
  12. salt: { type: String, required: true },
  13. password: { type: String, required: true },
  14. roles: { type: [String], required: true },
  15. });
  16.  
  17. export const User = Mongoose.model('User', UserSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement