Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ultima union #240

Merged
merged 19 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
100 changes: 0 additions & 100 deletions .github/workflows/asw2122.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,34 @@ on:
release:
types: [published]
jobs:
deploy-webapp:
unit-test-webapp:
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v2
unit-test-restapi:
runs-on: ubuntu-latest
defaults:
run:
working-directory: restapi
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v2
deploy-webapp:
needs: [unit-test-webapp,unit-test-restapi] runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy webapp
Expand All @@ -20,6 +46,7 @@ jobs:
env:
API_URI: "https://dede-es2a-restapi.herokuapp.com"
deploy-restapi:
needs: [unit-test-webapp,unit-test-restapi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/pruebaDeploy.ts

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dede_es2a

[![Actions Status](https://github.com/arquisoft/dede_0/workflows/CI%20for%20ASW2122/badge.svg)](https://github.com/arquisoft/dede_0/actions)
[![Actions Status](https://github.com/arquisoft/dede_0/workflows/CI%20for%20ASW2122/badge.svg)](https://github.com/arquisoft/dede_es2a/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_dede_es2a&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Arquisoft_dede_es2a)
[![codecov](https://codecov.io/gh/Arquisoft/dede_es2a/branch/master/graph/badge.svg?token=QeHZrwyDn4)](https://codecov.io/gh/Arquisoft/dede_es2a)

Expand Down Expand Up @@ -42,7 +42,7 @@ npm install
npm start
```

You should be able to access the application in [http://localhost:3000](http://localhost:3000).
You should be able to access the application in [https://dede-es2a-webapp.herokuapp.com/](https://dede-es2a-webapp.herokuapp.com/).

## More information
You can get more information about the respository in the other README files:
Expand Down
8 changes: 4 additions & 4 deletions README_es.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# asw2122_0

[![Actions Status](https://github.com/pglez82/asw2122_0/workflows/CI%20for%20ASW2122/badge.svg)](https://github.com/pglez82/asw2122_0/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=pglez82_asw2122_0&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=pglez82_asw2122_0)
[![codecov](https://codecov.io/gh/pglez82/asw2122_0/branch/master/graph/badge.svg?token=VN4XG9NTRO)](https://codecov.io/gh/pglez82/asw2122_0)
[![Actions Status](https://github.com/arquisoft/dede_0/workflows/CI%20for%20ASW2122/badge.svg)](https://github.com/arquisoft/dede_es2a/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_dede_es2a&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Arquisoft_dede_es2a)
[![codecov](https://codecov.io/gh/Arquisoft/dede_es2a/branch/master/graph/badge.svg?token=QeHZrwyDn4)](https://codecov.io/gh/Arquisoft/dede_es2a)

<p float="left">
<img src="https://blog.wildix.com/wp-content/uploads/2020/06/react-logo.jpg" height="100">
Expand Down Expand Up @@ -43,7 +43,7 @@ npm install
npm start
```

Deberias ser capaz de acceder a la aplicación en [http://localhost:3000](http://localhost:3000).
Deberias ser capaz de acceder a la aplicación en [https://dede-es2a-webapp.herokuapp.com](https://dede-es2a-webapp.herokuapp.com).

## Mas información
Encontrarás más información sobre el repositorio en los otros archivos README:
Expand Down
20 changes: 0 additions & 20 deletions restapi/modules/cloudinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ export function config(){
});
}


/*
export function config(){
cloudinary.config({
cloud_name : 'dypp8pt31',
api_key : '321597164512969',
api_secret: 'sM2uhnqaS53Sq9_HsPDLK63FS7I'
});
}*/


export function configTest(){
cloudinary.config({
cloud_name : 'university-of-oviedo',
Expand All @@ -32,13 +21,4 @@ export function configTest(){
});
}

/*
export function config(){
cloudinary.config({
cloud_name : process.env.CLOUDINARY_NAME!,
api_key : process.env.CLODINARY_API_KEY!,
api_secret: process.env.CLOUDINARY_API_SECRET!
})
console.log(process.env.CLOUDINARY_NAME);
}*/

1 change: 0 additions & 1 deletion restapi/modules/gestorDB.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//import mongoose from "mongoose";
const mongoose = require('mongoose')
require('dotenv').config()

Expand Down
30 changes: 0 additions & 30 deletions restapi/routes/juguete.router.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Console } from "console";
import express, { Request, response, Response } from "express"
import cloudinary from 'cloudinary';
import { ObjectId } from "mongodb";

export const jugueteRouter = express.Router()
const Juguete = require("../models/Juguete");
Expand Down Expand Up @@ -37,9 +35,7 @@ jugueteRouter.get("/withStock", async (req: Request, res: Response) => {
jugueteRouter.get("/:nombre", async (req: Request, res: Response) => {
try {
let filter = { nombre: req.params.nombre }
//console.log(filter);
let juguete = await Juguete.findOne(filter);
//console.log(juguete);
if (juguete) {
res.json(juguete);
}
Expand Down Expand Up @@ -83,7 +79,6 @@ async function borrarImagen(imagen: String) {
*/
jugueteRouter.post("/", async (req: Request, res: Response) => {
try {
console.log("NUEVO JUGUETE");
let nuevoJuguete = {
nombre: req.body.nombre,
descripcion: req.body.descripcion,
Expand All @@ -92,7 +87,6 @@ jugueteRouter.post("/", async (req: Request, res: Response) => {
categoria: req.body.categoria,
stock: req.body.stock
};
console.log(nuevoJuguete);
let juguete = await Juguete.findOne({ nombre: nuevoJuguete.nombre });
if (juguete) {
res.send("Este juguete ya existe");
Expand Down Expand Up @@ -136,38 +130,14 @@ jugueteRouter.post("/addStock/:nombre", async (req: Request, res: Response) => {
try {
const filter = { nombre: req.params.nombre }
var juguete = await Juguete.findOne(filter);
//console.log(juguete.stock)
//console.log(req.body.stock)
const number: Number = juguete.stock + req.body.stock
const stock = { stock: number }
//console.log(stock)
var jugueteActualizado = await Juguete.findOneAndUpdate(filter, stock, { new: true })
res.send("Stock del juguete añadido correctamente");

} catch (error) {
res.status(500).send("Error al añadir stock al juguete")
}
});
/*
jugueteRouter.post("/subtock/:nombre", async (req:Request,res:Response) => {
try{
const filter = {
nombre: req.params.nombre,
}

var juguete = await JugueteRepository.findJuguete(filter);

const stock = {stock: juguete.stock - req.body.stock}

var jugueteActualizado = await JugueteRepository.updateJuguete(filter,stock);
if(jugueteActualizado){
res.send("Stock del juguete restado correctamente");
} else{
res.status(500).send("No se pudo restar stock al producto")
}
}catch (error){
res.status(500).send("Error al restar stock al juguete")
}
});
*/
export default jugueteRouter;
Loading