Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement