From ecea83c8b4aa56f958f746f7666145a902f95c5d Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Mon, 23 Oct 2023 15:52:13 -0300 Subject: [PATCH] Fix bugs and add run.sh (dev) --- README.md | 27 ++++++++++++++++++---- browser-domain/src/Api.ts | 2 ++ browser-domain/src/hooks/useFetchZones.tsx | 4 +--- run.sh | 23 ++++++++++++++++++ 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 run.sh diff --git a/README.md b/README.md index 18a46b9..2bc7312 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # fids -## Contributing - -``` -pre-commit install -``` +## Componentes ### auth-domain @@ -21,3 +17,24 @@ Contiene `flights-information` con su base de datos. Maneja todo lo relacionado ### screens-domain PWA pensado para utilizarse en un aeropuerto. Se maneja con un solo `origin` y con el query param `lastUpdated` para pedir cambios. Esta tiene una base datos para cachear los resultados y poder funcionar offline. + +## Uso + +Primero, deberá configurar los `.env` como usted prefiera. Copie y modifique los ejemplos: + +``` +cp flights-domain/.env.prod.example flights-domain/.env.prod +cp user-domain/.env.prod.example user-domain/.env.prod +``` + +Luego, para levantar todos los componentes, basta con ejecutar: + +``` +./run.sh +``` + +## Contribuir + +``` +pre-commit install +``` diff --git a/browser-domain/src/Api.ts b/browser-domain/src/Api.ts index c43e4c6..222d411 100644 --- a/browser-domain/src/Api.ts +++ b/browser-domain/src/Api.ts @@ -7,6 +7,7 @@ const auth_instance = new Axios({ accept: "application/json", "Content-Type": "application/json", }, + validateStatus: (x) => { return !(x < 200 || x > 204) } }); const flights_instance = new Axios({ @@ -15,6 +16,7 @@ const flights_instance = new Axios({ accept: "application/json", "Content-Type": "application/json", }, + validateStatus: (x) => { return !(x < 200 || x > 204) } }); auth_instance.interceptors.response.use( diff --git a/browser-domain/src/hooks/useFetchZones.tsx b/browser-domain/src/hooks/useFetchZones.tsx index 40c5242..5e9e29a 100644 --- a/browser-domain/src/hooks/useFetchZones.tsx +++ b/browser-domain/src/hooks/useFetchZones.tsx @@ -14,9 +14,7 @@ export const useFetchZones = (origin: string | null) => { .then((data) => { setZones(data); }) - .catch((error) => { - setError(error as string); - }); + .catch((error) => {}); }, []); return { zones, error }; diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..99448e5 --- /dev/null +++ b/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +export USER_MANAGER=auth-domain/user-manager +docker build $USER_MANAGER -f $USER_MANAGER/Dockerfile.prod -t slococo/user-manager:prod +export FLIGHTS_INFORMATION=flights-domain/flights-information +docker build $FLIGHTS_INFORMATION -f $FLIGHTS_INFORMATION/Dockerfile.prod -t slococo/flights-information:prod +docker build screen-domain -f screen-domain/Dockerfile.prod -t slococo/screen-client:prod +docker build browser-domain -f browser-domain/Dockerfile.prod -t slococo/browser-client:prod + +export API_IMAGE=slococo/flights-information:prod +docker compose -f flights-domain/docker-compose.yml --env-file flights-domain/.env.prod down +docker compose -f flights-domain/docker-compose.yml --env-file flights-domain/.env.prod up -d +export API_IMAGE=slococo/user-manager:prod +docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod down +docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod up -d + +docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod exec usermanager-api python manage.py recreate_db +docker compose -f auth-domain/docker-compose.yml --env-file auth-domain/.env.prod exec usermanager-api python manage.py seed_db + +export CLIENT_IMAGE=slococo/screen-client:prod +docker compose -f screen-domain/docker-compose.yml up -d +export CLIENT_IMAGE=slococo/browser-client:prod +docker compose -f browser-domain/docker-compose.yml up -d