var mongoose     = require('mongoose');
var Schema       = mongoose.Schema;

var Objectid = mongoose.Schema.Types.ObjectId;

var ProductSchema   = new Schema({
	name: String,
	description: String,
	amount: { type: Number, validate: function(v) { return (v > 0) }, required: true },
	cred_type: { type: String, validate: /space|stuff|bandwidth/, index: true, required: true },
	member_discount: { type: Number, default: 0 },
	_owner_id: Objectid,
	_deleted: { type: Boolean, default: false, index: true },
});

ProductSchema.set("_perms", {
	admin: "crud",
	owner: "r",
	user: "r",
	all: "r"
});


module.exports = mongoose.model('Product', ProductSchema);
var mongoose     = require('mongoose');
var Schema       = mongoose.Schema;

var Objectid = mongoose.Schema.Types.ObjectId;

var ProductSchema   = new Schema({
	name: String,
	description: String,
	amount: { type: Number, validate: function(v) { return (v > 0); }, required: true },
	cred_type: { type: String, validate: /space|stuff|bandwidth/, index: true, required: true },
	member_discount: { type: Number, default: 0 },
	topup_size: Number,
	_owner_id: Objectid,
	_deleted: { type: Boolean, default: false, index: true },
});

ProductSchema.set("_perms", {
	admin: "crud",
	owner: "r",
	user: "r",
	all: "r"
});


module.exports = mongoose.model('Product', ProductSchema);
Add topup size to product model
Add topup size to product model
