{"size": 1559, "ext": "js", "max_stars_repo_path": "app/models/user.js", "max_stars_repo_name": "joaofernandes450/spa-backend-node-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/models/user.js", "max_issues_repo_name": "joaofernandes450/spa-backend-node-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/models/user.js", "max_forks_repo_name": "joaofernandes450/spa-backend-node-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.012195122, "max_line_length": 51, "alphanum_fraction": 0.4252726106}
var mongoose = require('../databases/userDB');
mongoose.set('debug', true)

var Schema = mongoose.Schema;

var UserSchema = new Schema({
    firstName: {
        type: String,
        required: true
    },
    lastName: {
        type: String,
        required: true
    },
    email: {
        type: String,
        required: true,
        unique: true
    },
    phoneNumber: {
        type: String,
        required: true,
        unique: true
    },
    vat: {
        type: String,
    },
    password: {
        type: String,
        required: true
    },
    address: {
        street: {
            type: String,
            required: true,
        },
        postalCode: {
            type: String,
            required: true,
        },
        city: {
            type: String,
            required: true,
        },
        latitude: {
            type: Number,
            required: true,
        },
        longitude: {
            type: Number,
            required: true,
        }
    },
    deliveryInformation: {
        name: {
            type: String,
            required: true
        },
        type: {
            type: String,
            enum: ['residential', 'company'],
            required: true
        },
        floor: {
            type: String
        },
        otherInfo: {
            type: String,
        },
        driverInfo: {
            type: String
        }
    },
    userHash: {
        type: String
    },
    recoveryCode: {
        type: String
    }
})

module.exports = mongoose.model('User', UserSchema)