Skip to content

Commit

Permalink
Merge pull request #208 from Arquisoft/develop
Browse files Browse the repository at this point in the history
Despliegue
  • Loading branch information
mariolada authored May 1, 2022
2 parents 560f44b + 6772c7f commit b48acf6
Show file tree
Hide file tree
Showing 21 changed files with 877 additions and 321 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pruebaDeploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI for ASW2122
on:
release:

types: [published]
jobs:
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
Expand Down
3 changes: 3 additions & 0 deletions restapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM node:16.13.1
LABEL org.opencontainers.image.source https://github.com/Arquisoft/dede_es2a
COPY . /app
WORKDIR /app


#Install the dependencies
RUN npm install

CMD [ "npm", "start" ]
187 changes: 146 additions & 41 deletions restapi/package-lock.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions restapi/routes/juguete.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,26 @@ jugueteRouter.post("/addStock/:nombre", async (req:Request,res:Response) => {
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;
2 changes: 1 addition & 1 deletion restapi/routes/pedido.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pedidoRouter.get("/byUser/:user", async(req:Request,res:Response)=>{
res.send("El usuario no existe");
}
else{
var pedidos = await Pedido.find({"usuario":usuario._id});
var pedidos = await Pedido.find({"usuario":usuario._id}).populate("juguetes._id");
if(pedidos.length > 0){
res.send(pedidos);
}else{
Expand Down
6 changes: 3 additions & 3 deletions restapi/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import { pedidoRouter } from "./routes/pedido.router";
import { usuarioRouter } from "./routes/usuario.router";

const app: Application = express();
const port: number = 5000;
const port = process.env.PORT || 5000;


require('dotenv').config()
let bd = require('./modules/gestorDB')
let {config} = require('./modules/cloudinary');

const options: cors.CorsOptions = {
origin: ['http://localhost:3000']
//origin: ['https://dede-es2a-webapp.herokuapp.com']
//origin: ['http://localhost:3000']
origin: ['https://dede-es2a-webapp.herokuapp.com']
};

const metricsMiddleware:RequestHandler = promBundle({includeMethod: true});
Expand Down
2 changes: 1 addition & 1 deletion webapp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import express,{Application} from 'express';
//setting the option module to commonjs

var app: Application = express()
const port: number = 3000;
const port = process.env.PORT || 3000;

app.use(express.static('build'))

Expand Down
Loading

0 comments on commit b48acf6

Please sign in to comment.