{"size": 792, "ext": "js", "max_stars_repo_path": "generators/expressjs_resource/templates/resource.model.js", "max_stars_repo_name": "aeksco/codotype-generator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "generators/expressjs_resource/templates/resource.model.js", "max_issues_repo_name": "aeksco/codotype-generator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "generators/expressjs_resource/templates/resource.model.js", "max_forks_repo_name": "aeksco/codotype-generator", "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": 21.4054054054, "max_line_length": 75, "alphanum_fraction": 0.476010101}
const mongoose = require('mongoose')
const Schema = mongoose.Schema

// // // //

const <%= schema.label %> = new Schema({
    <% for (index in schema.attributes) { %>
    <% let attr = schema.attributes[index] %>
    <% if (attr.datatype === 'BOOL') { %>
    <%= attr.identifier %>:{
        type: Boolean
      },
    <% } else if (attr.datatype === 'NUMBER') { %>
    <%= attr.identifier %>:{
        type: Number
      },
    <% } else { %>
    <%= attr.identifier %>:{
        type: String
      },
    <% } %>
    <% } %>
},
    // Collection options
    {
        timestamps: {
            createdAt: 'createdOn',
            updatedAt: 'updatedOn'
        },
        versionKey: false
    }
);

// // // //

module.exports = mongoose.model('<%= schema.label %>', <%= schema.label %>)
