{"size": 593, "ext": "js", "max_stars_repo_path": "backend/models/Product.js", "max_stars_repo_name": "VieiraHenrique/FabLab", "max_stars_repo_stars_event_min_datetime": "2021-08-08T20:40:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-08T20:40:31.000Z", "max_issues_repo_path": "07-Collaborations/07-02-FabLab_Charleroi/backend/models/Product.js", "max_issues_repo_name": "nicode-io/The_Junior_Way", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "07-Collaborations/07-02-FabLab_Charleroi/backend/models/Product.js", "max_forks_repo_name": "nicode-io/The_Junior_Way", "max_forks_repo_forks_event_min_datetime": "2021-09-23T12:05:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-03T10:35:11.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 17.4411764706, "max_line_length": 58, "alphanum_fraction": 0.5413153457}
const mongoose = require('mongoose');
const Schema = mongoose.Schema;


/**
 * Database Product schema
 */

// Define schema
const ProductSchema = new Schema({
    name : {
        type: String,
        required: true 
    },
    category : {
        type: String,
        required: true
    },
    tarif : {
        type: Number,
        required: true
    },
    stock : {
        type: Number,
        required: true
    },
    invoice : [{
        type : Schema.Types.ObjectId,
        ref : "Invoice"
    }]
});

// Export schema
module.exports = mongoose.model('Product', ProductSchema);