{"size": 547, "ext": "js", "max_stars_repo_path": "models/shortUrl.js", "max_stars_repo_name": "kitmak72/shortURL", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/shortUrl.js", "max_issues_repo_name": "kitmak72/shortURL", "max_issues_repo_issues_event_min_datetime": "2022-03-29T03:28:28.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T03:28:30.000Z", "max_forks_repo_path": "models/shortUrl.js", "max_forks_repo_name": "kitmak72/shortURL", "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": 13.3414634146, "max_line_length": 60, "alphanum_fraction": 0.5575868373}
const mongoose = require('mongoose');

const shortUrlSchema = new mongoose.Schema({
  userID: {
    type: String,
    default: 'guest',
  },

  urlCode: {
    type: String,
    unique: true,
  },

  origin: {
    type: String,
    required: true,
  },

  short: String,

  clicks: {
    type: Number,
    default: 0,
  },

  meta: [
    {
      region: String,
      platform: String,
      accessedAt: Date,
    },
  ],

  createdAt: {
    type: Date,
    default: Date.now,
  },
});

module.exports = mongoose.model('shortUrl', shortUrlSchema);
