{"size": 1532, "ext": "js", "max_stars_repo_path": "models/Users.js", "max_stars_repo_name": "learningdollars/iloris-dockerize-nodejs-nginx-reverse-prox", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/Users.js", "max_issues_repo_name": "learningdollars/iloris-dockerize-nodejs-nginx-reverse-prox", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/Users.js", "max_forks_repo_name": "learningdollars/iloris-dockerize-nodejs-nginx-reverse-prox", "max_forks_repo_forks_event_min_datetime": "2021-06-14T15:59:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-14T15:59:46.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 27.8545454545, "max_line_length": 140, "alphanum_fraction": 0.4751958225}
/* Base Model & Mongoose ORM */
const Mongoose = require('mongoose');

/**
 * This Class contains the schema required to model a user collection. It also contains reusable methods imported from the mongoose library.
 *
 * @author Ilori Stephen A
 * @returns {Object}
 * @name Signup
 * @alias Register
 * @param {Null}
 *
 */
class User {
    user() {
        const Schema = Mongoose.Schema;
        const UserBluePrint = new Schema({
            firstName: {
                type: String,
                required: [true, "The name field is required"]
            },
            lastName: {
                type: String,
                required: [true, "The name field is required"]
            },
            email: {
                type: String,
                unqiue: true,
                required: [true, "The email field is required"]
            },
            status: {
                type: Number,
                default: 0,
                /* 0: Pending, 1: Approved, 2: Suspended. */
            },
            password: {
                type: String,
                required: [true, "The password field is required"]
            },
            createdAt: {
                type: String,
                default: global.Date()
            },
            updatedAt: {
                type: String,
                default: global.Date()
            }
        });

        const User = Mongoose.model.Users || Mongoose.model('Users', UserBluePrint);
        return User;
    }
}

module.exports = new User().user();