{"size": 729, "ext": "js", "max_stars_repo_path": "models/Employees.js", "max_stars_repo_name": "markallen01666/node-mongodb-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/Employees.js", "max_issues_repo_name": "markallen01666/node-mongodb-api", "max_issues_repo_issues_event_min_datetime": "2021-05-10T16:26:23.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-10T16:26:23.000Z", "max_forks_repo_path": "models/Employees.js", "max_forks_repo_name": "markallen01666/node-mongodb-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 17.7804878049, "max_line_length": 76, "alphanum_fraction": 0.6570644719}
// Employees database schema

const mongoose = require('mongoose')
const Schema = mongoose.Schema
const uniqueValidator = require('mongoose-unique-validator')

const EmployeeSchema = new Schema({
  staffId: {
    type: String,
    required: true,
    unique: true
  },
  firstName: {
    type: String,
    required: true
  },
  lastName: {
    type: String,
    required: true
  },
  office: {
    type: String,
    required: true
  },
  position: {
    type: String,
    required: true
  },
  Telephone: {
    type: String
  },
  email: {
    type: String
  }
})

EmployeeSchema.plugin(uniqueValidator) // Handle error on duplicate staff ID

const Employee = mongoose.model('Employee', EmployeeSchema)
module.exports = Employee
