Skip to content

Instantly share code, notes, and snippets.

@connors511
Created June 7, 2013 12:54
Show Gist options
  • Save connors511/5729025 to your computer and use it in GitHub Desktop.
Save connors511/5729025 to your computer and use it in GitHub Desktop.
var schema = new Schema({
name: { type : String, default : '', trim : true },
description: {
body: { type : String, default : '', trim : true },
updated_at: { type : Date, default : Date.now },
updated_by: { type : Schema.ObjectId, ref : 'User' }
},
report: {
day: { type : String, default : 'last tuesday', trim : true },
auto: { type: Boolean }
},
initial: {
cash: { type : Number, default : 0 },
bank: { type : Number, default : 0 }
},
tax: { type : Number, default : 0, min: 0 },
deposit: { type : Number, default : 0, min: 0 },
kitchen: { type : Schema.ObjectId, ref : 'Kitchen' },
members: [{
user: { type : Schema.ObjectId, ref : 'User' },
joined_at: { type : Date, default : Date.now },
}],
items: [{
name,
price,
stock,
history: [{
change,
date
}],
created : {
at,
by
}
}],
created: {
by: { type : Schema.ObjectId, ref : 'User' },
at: { type : Date, default : Date.now }
},
updated: {
by: { type : Schema.ObjectId, ref : 'User' },
at: { type : Date, default : Date.now }
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment