Skip to content

Commit

Permalink
working on swag shop api
Browse files Browse the repository at this point in the history
  • Loading branch information
Mennatallah Ramadan authored and Mennatallah Ramadan committed Mar 3, 2019
1 parent d42966c commit b513fe6
Show file tree
Hide file tree
Showing 6 changed files with 686 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
10 changes: 10 additions & 0 deletions models/product.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var mongoose = require('mongoose');

var product = new mongoose.Schema({
title: String,
price: Number,
likes: {type: Number, default: 0}
})

//product is what will stored in JS
module.exports = mongoose.model('Product', product);
10 changes: 10 additions & 0 deletions models/wishList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var mongoose = require('mongoose');
var ObjectId = mongoose.Schema.Types.ObjectId;

var wishList = new mongoose.Schema({
title: {type: String, default: "Cool Wish List", require: true},
products: [{type: ObjectId, ref:'product'}] //this is the relationships
});

//product is what will stored in JS
module.exports = mongoose.model('WishList', wishList);
Loading

0 comments on commit b513fe6

Please sign in to comment.