Files
freeplanet_serverside/src/server/models/variant.js
Paolo Arena 396bfea289 Disabled debug Mongoose
Updated modules
fixed tests
2021-09-22 01:13:41 +02:00

41 lines
783 B
JavaScript
Executable File

var mongoose = require('mongoose').set('debug', false)
var variantSchema = mongoose.Schema({
productID: {
type: String
},
imagePath: {
type: String
},
color: {
type: String
},
size: {
type: String
},
quantity: {
type: Number
},
title: {
type: String
},
price: {
type: Number
}
});
var Variant = module.exports = mongoose.model('Variant', variantSchema);
module.exports.getVariantByID = function(id, callback){
Variant.findById(id, callback);
}
module.exports.getVariantProductByID = function(id, callback){
var query = {productID: id};
Variant.find(query, callback);
}
module.exports.getAllVariants = function(callback){
Variant.find(callback)
}