{"size": 780, "ext": "js", "max_stars_repo_path": "server/data/Car.js", "max_stars_repo_name": "Michaela07313/exam-project", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/data/Car.js", "max_issues_repo_name": "Michaela07313/exam-project", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/data/Car.js", "max_forks_repo_name": "Michaela07313/exam-project", "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": 35.4545454545, "max_line_length": 63, "alphanum_fraction": 0.6948717949}
const mongoose = require('mongoose')

let requiredValidationMessage = '{PATH} is required.'

let carSchema = mongoose.Schema({
  make: { type: String, required: requiredValidationMessage },
  model: { type: String, required: requiredValidationMessage },
  price: { type: Number, required: requiredValidationMessage },
  image: { type: String, requred: false },
  date: { type: Date, default: Date.now },
  views: { type: Number, default: 0 },
  deleteMarker: { type: Boolean, default: false },
  totalComments: { type: Number, default: 0 },
  comments: [{
    commentText: { type: String, requiredValidationMessage },
    username: { type: String, requiredValidationMessage },
    commentDate: { type: Date, default: Date.now }
  }]
})

let Car = mongoose.model('Car', carSchema)
