Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d105b49
Create .travis.yml
Cucho145U Jan 31, 2021
420f6b0
Update .travis.yml
Cucho145U Feb 3, 2021
f4ed4ad
Update .travis.yml
Cucho145U Feb 3, 2021
0021d07
Ingreso Producto Backend
alexojo2020 Feb 3, 2021
b49212c
Merge pull request #1 from UwUnsaac/MoNzOn
Cucho145U Feb 3, 2021
3570941
Cambios
alexojo2020 Mar 2, 2021
9b5e860
Eliminar
alexojo2020 Mar 2, 2021
415d8a8
Merge pull request #2 from UwUnsaac/MoNzOn
Cucho145U Mar 2, 2021
5bf44fe
Actualizacion
alexojo2020 Mar 3, 2021
4c471bc
Merge pull request #3 from UwUnsaac/MoNzOn
ManuelVelarde2212 Mar 3, 2021
6ff27b8
Actualizacion
alexojo2020 Mar 9, 2021
8514906
Merge pull request #4 from UwUnsaac/MoNzOn
ManuelVelarde2212 Mar 9, 2021
657e2ac
Actualizacion 3
alexojo2020 Mar 10, 2021
7318b76
Merge pull request #5 from UwUnsaac/MoNzOn
ManuelVelarde2212 Mar 10, 2021
31eb0e3
Quantity updated
SHJAndre Mar 10, 2021
48e3055
Update README.md
ManuelVelarde2212 Mar 10, 2021
42f6b26
Update README.md
ManuelVelarde2212 Mar 10, 2021
0a120a8
Actualizacion ingreso producto
alexojo2020 Mar 11, 2021
ae04c6c
Merge pull request #6 from UwUnsaac/MoNzOn
alexojo Mar 11, 2021
c6c2a7e
Añadir variable Color como Tag
alexojo2020 Mar 11, 2021
c950470
Merge pull request #7 from UwUnsaac/MoNzOn
alexojo Mar 11, 2021
a3b64b9
Añadir variable Color como Tag.2
alexojo2020 Mar 11, 2021
20b6f19
Merge pull request #8 from UwUnsaac/MoNzOn
alexojo Mar 11, 2021
a0cde89
Update index.js
alexojo Mar 11, 2021
b8d5ade
busqueda por color
alexojo2020 Mar 11, 2021
03a526a
Merge branch 'master' into MoNzOn
alexojo Mar 11, 2021
ad129d9
Update index.js
alexojo2020 Mar 11, 2021
1f54dd6
Update index.js
alexojo2020 Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: node_js
node_js:
- "stable"
cache: npm

install:
- npm ci

script:
- CI='' npm run

deploy:
provider: heroku
api_key: $HEROKU_API_KEY
app: e-commerce-uwunsaac-backend
skip-cleanup: true
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"compile-hero.disable-compile-files-on-did-save-code": false
}
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
# Full stack ecommerce online store application
# Aplicación fullstack de un catálogo para venta de productos online



#### front-end codes [click here](https://github.com/levelopers/Ecommerce-Reactjs)
#### Código de front-end [aquí](https://github.com/UwUnsaac/Ecommerce-Reactjs)

#### api documentation: [swaggerHub](https://app.swaggerhub.com/apis-docs/levelopers2/Ecommerce/1.0.0)

#### populate data: run `node ./seed` (make sure you fill up `mongo-config` file with mongodb url)



<details>
<summary>data model</summary>
<p>

![react-native-store relational model diagram](https://user-images.githubusercontent.com/38830527/92665263-1c4cb880-f2d4-11ea-85a4-201c41517123.png)

</p>
</details>
#### Llenado de datos base: run `node ./seed` (Asegúrese de llenar de manera correcta el archivo `mongo-config` con el enlace correspondiente a su base de datos)
7 changes: 7 additions & 0 deletions configs/dist/mongo-config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use strict";

//const direccion="mongodb://localhost:27017/[DataEComerce][DataCollection]";
//const direccion="mongodb+srv://admin:<admin>@cluster0.ikple.mongodb.net/test"
var direccion = "mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaacBD?retryWrites=true&w=majority"; //const direccion="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority"

module.exports = direccion;
2 changes: 1 addition & 1 deletion configs/mongo-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//const direccion="mongodb://localhost:27017/DataEComerceNode";
//const direccion="mongodb://localhost:27017/[DataEComerce][DataCollection]";
//const direccion="mongodb+srv://admin:<admin>@cluster0.ikple.mongodb.net/test"
const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaacBD?retryWrites=true&w=majority"
//const direccion="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority"
Expand Down
6 changes: 6 additions & 0 deletions models/Category.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ var categorySchema = mongoose.Schema({

var Category = module.exports = mongoose.model('Categories', categorySchema);

/////////////////////////////////
/*module.exports.createCategory = function (newCategory, callback){
newCategory.save(callback);
}*/


// These are functions to get data from the database. You can even reach the information
// without calling this functions but I just want to show you how you can add some functions
// to your model file to get specific data.
Expand Down
21 changes: 15 additions & 6 deletions models/Product.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ var productSchema = mongoose.Schema({
description: {
type: String
},
department: {
type: String
},
category: {
type: String
type: Array
},
price: {
type: Number
Expand All @@ -25,16 +22,28 @@ var productSchema = mongoose.Schema({
size: {
type: String
},
quantity: {
type: Number
cellphone: {
type: String
},
date: {
type: Number
},
pregunta1: {
type: Array
},
pregunta2: {
type: Array
}
});

var Product = module.exports = mongoose.model('Product', productSchema);

/////////////////////////////////
module.exports.createProduct = function (newProduct, callback){
newProduct.save(callback);
}


module.exports.getAllProducts = function (query, sort, callback) {
Product.find(query, null, sort, callback)
}
Expand Down
3 changes: 0 additions & 3 deletions models/Variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ var variantSchema = mongoose.Schema({
size: {
type: String
},
quantity: {
type: Number
},
title: {
type: String
},
Expand Down
4 changes: 2 additions & 2 deletions modules/Cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Cart {
if (!storedItem) {
storedItem = this.items[id] = { item: item, qty: 0, price: 0 };
}
storedItem.qty++;
storedItem.qty=1;
storedItem.price = parseFloat((storedItem.item.price * storedItem.qty).toFixed(2));
this.items[id]=storedItem
this.totalQty++;
Expand Down Expand Up @@ -46,7 +46,7 @@ class Cart {
}

increaseQty(id) {
this.items[id].qty++;
this.items[id].qty=1;
this.items[id].price += this.items[id].item.price;
this.items[id].price = parseFloat(this.items[id].price.toFixed(2))
this.totalQty++;
Expand Down
98 changes: 98 additions & 0 deletions modules/dist/Cart.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
"use strict";

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

var cartModel = require('../models/Cart');

var Cart =
/*#__PURE__*/
function () {
function Cart(oldCart) {
_classCallCheck(this, Cart);

this.items = oldCart.items || {};
this.totalQty = oldCart.totalQty || 0;
this.totalPrice = oldCart.totalPrice || 0;
this.userId = oldCart.userId || "";
}

_createClass(Cart, [{
key: "add",
value: function add(item, id) {
var storedItem = this.items[id];

if (!storedItem) {
storedItem = this.items[id] = {
item: item,
qty: 0,
price: 0
};
}

storedItem.qty++;
storedItem.price = parseFloat((storedItem.item.price * storedItem.qty).toFixed(2));
this.items[id] = storedItem;
this.totalQty++;
this.totalPrice += storedItem.item.price;
this.totalPrice = parseFloat(this.totalPrice.toFixed(2));
return this;
}
}, {
key: "generateModel",
value: function generateModel() {
var newCart = new cartModel({
items: this.items,
totalQty: this.totalQty,
totalPrice: this.totalPrice,
userId: this.userId
});
return newCart;
}
}, {
key: "decreaseQty",
value: function decreaseQty(id) {
this.items[id].qty--;
this.items[id].price -= this.items[id].item.price;
this.items[id].price = parseFloat(this.items[id].price.toFixed(2));
this.totalQty--;
this.totalPrice -= this.items[id].item.price;
this.totalPrice = parseFloat(this.totalPrice.toFixed(2));

if (this.items[id].qty <= 0) {
delete this.items[id];
}

return this;
}
}, {
key: "increaseQty",
value: function increaseQty(id) {
this.items[id].qty++;
this.items[id].price += this.items[id].item.price;
this.items[id].price = parseFloat(this.items[id].price.toFixed(2));
this.totalQty++;
this.totalPrice += this.items[id].item.price;
this.totalPrice = parseFloat(this.totalPrice.toFixed(2));
return this;
}
}, {
key: "generateArray",
value: function generateArray() {
var arr = [];

for (var id in this.items) {
arr.push(this.items[id]);
}

return arr;
}
}]);

return Cart;
}();

module.exports = Cart;
Loading