Skip to content

Commit

Permalink
feat: static api
Browse files Browse the repository at this point in the history
  • Loading branch information
enzonotario committed Jan 19, 2024
1 parent 68071a6 commit 7e9c93b
Show file tree
Hide file tree
Showing 17,055 changed files with 194,442 additions and 402 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"customizations": {
"codespaces": {
"openFiles": [
"api/app.esjs"
"src/app.esjs"
]
}
},
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/diario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Actualización diaria de datos

on:
schedule:
- cron: '10 22 * * *' # Actualiza a las 22:10 UTC (19:10 ART)

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Run cron
run: pnpm run cron diario

- name: Commit and push if changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add -A
timestamp=$(date -u)
timestampArg=$(date -u -d "3 hours")
git commit -m "Latest data: ${timestampArg}" || exit 0
git push
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'datos'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
84 changes: 84 additions & 0 deletions .github/workflows/mensual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Actualización diaria de datos

on:
schedule:
- cron: '10 22 1 * *' # Actualiza a las 22:10 UTC (19:10 ART)

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Run cron
run: pnpm run cron mensual

- name: Commit and push if changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add -A
timestamp=$(date -u)
timestampArg=$(date -u -d "3 hours")
git commit -m "Latest data: ${timestampArg}" || exit 0
git push
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'datos'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.env
docs/.vitepress/cache
docs/.vitepress/.temp
31 changes: 31 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Registros (logs)
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependencias
node_modules

# Archivos generados
dist
dist-ssr
.vercel

# Configuraciones de Editores
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
docs/.vitepress/cache
docs/.vitepress/.temp
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"semi": false,
"plugins": ["prettier-plugin-esjs"]
}
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api.argentinadatos.com
9 changes: 0 additions & 9 deletions api/app.esjs

This file was deleted.

8 changes: 0 additions & 8 deletions api/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions datos/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"estado": "Correcto"
}
37 changes: 37 additions & 0 deletions datos/v1/cotizaciones/2023/10/22/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"moneda": "USD",
"compra": 347.5,
"venta": 365.5,
"fecha": "2023-10-22",
"fechaActualizacion": "2023-10-22T00:00:00.000Z"
},
{
"moneda": "EUR",
"compra": 370.34,
"venta": 370.86,
"fecha": "2023-10-22",
"fechaActualizacion": "2023-10-22T00:00:00.000Z"
},
{
"moneda": "BRL",
"compra": 69.45,
"venta": 69.57,
"fecha": "2023-10-22",
"fechaActualizacion": "2023-10-22T00:00:00.000Z"
},
{
"moneda": "CLP",
"compra": 36.97,
"venta": 37.09,
"fecha": "2023-10-22",
"fechaActualizacion": "2023-10-22T00:00:00.000Z"
},
{
"moneda": "UYU",
"compra": 8.76,
"venta": 8.78,
"fecha": "2023-10-22",
"fechaActualizacion": "2023-10-22T00:00:00.000Z"
}
]
37 changes: 37 additions & 0 deletions datos/v1/cotizaciones/2023/10/23/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"moneda": "USD",
"compra": 347.5,
"venta": 365.5,
"fecha": "2023-10-23",
"fechaActualizacion": "2023-10-23T00:00:00.000Z"
},
{
"moneda": "EUR",
"compra": 373.3,
"venta": 373.45,
"fecha": "2023-10-23",
"fechaActualizacion": "2023-10-23T00:00:00.000Z"
},
{
"moneda": "BRL",
"compra": 69.8,
"venta": 69.81,
"fecha": "2023-10-23",
"fechaActualizacion": "2023-10-23T00:00:00.000Z"
},
{
"moneda": "CLP",
"compra": 37.55,
"venta": 37.58,
"fecha": "2023-10-23",
"fechaActualizacion": "2023-10-23T00:00:00.000Z"
},
{
"moneda": "UYU",
"compra": 8.77,
"venta": 8.78,
"fecha": "2023-10-23",
"fechaActualizacion": "2023-10-23T00:00:00.000Z"
}
]
37 changes: 37 additions & 0 deletions datos/v1/cotizaciones/2023/10/24/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"moneda": "USD",
"compra": 347.5,
"venta": 365.5,
"fecha": "2023-10-24",
"fechaActualizacion": "2023-10-24T00:00:00.000Z"
},
{
"moneda": "EUR",
"compra": 370.63,
"venta": 370.83,
"fecha": "2023-10-24",
"fechaActualizacion": "2023-10-24T00:00:00.000Z"
},
{
"moneda": "BRL",
"compra": 70.08,
"venta": 70.11,
"fecha": "2023-10-24",
"fechaActualizacion": "2023-10-24T00:00:00.000Z"
},
{
"moneda": "CLP",
"compra": 37.73,
"venta": 37.82,
"fecha": "2023-10-24",
"fechaActualizacion": "2023-10-24T00:00:00.000Z"
},
{
"moneda": "UYU",
"compra": 8.77,
"venta": 8.78,
"fecha": "2023-10-24",
"fechaActualizacion": "2023-10-24T00:00:00.000Z"
}
]
Loading

0 comments on commit 7e9c93b

Please sign in to comment.