Skip to content

Commit

Permalink
fix: add BCV entity
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavoerivero committed Oct 11, 2024
1 parent eeac65c commit f42146b
Show file tree
Hide file tree
Showing 43 changed files with 128,856 additions and 843 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/young-shoes-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'venecodollar': patch
---

Fix BCV entity
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PORT=
URL=""
API=""
API_OLD=""
API_VER_URL=""
API_DOC=""
BASE_URL=""
BCV_URL=""
SERVICE_API=""
EMAIL=""
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended"],
"parserOptions": { "ecmaVersion": 2018, "sourceType": "module" },
"rules": {},
"overrides": [
{
"files": ["*/**/**.test.*"],
"env": {
"jest": true
}
}
],
"ignores": [".changeset", ".husky", "coverage", "node_modules", "build", "dist"]
}
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm run test
- name: Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
node_modules

yarn.lock
package-lock.json
yarn.lock

node_modules
public
build
dist

.env

dist
build
coverage
21 changes: 21 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.changeset
.github
.husky
coverage

node_modules

yarn.lock
package-lock.json

.eslintrc.json
babel.config.js
eslint.config.mjs
jest.config.ts

.gitignore
.npmignore
.prettierignore

**/*/*.test.ts
**/*/*.test.js
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist
build
node_modules

.changeset
.husky
coverage
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}
69 changes: 35 additions & 34 deletions README-ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ import * as Venecodollar from "venecodollar"
o

```TypeScript
const {
getDollarPrices,
getDollarPricesWithAverage,
calculateBsToDollar,
const {
getDollarPrices,
getDollarPricesWithAverage,
calculateBsToDollar,
calculateDollarToBs,
getEuroPrices,
getEuroPricesWithAverage,
Expand Down Expand Up @@ -105,19 +105,19 @@ El paquete dispone de dos (4) funciones, getDollarPrices(), getDollarPricesWithA

La librería tiene a su disposición ocho (9) funciones. Cuatro (4) para valores del dólar y cuatro (4) para valores del euro:

* Funciones para valores de dólares:
- getDollarPrices()
- getDollarPricesWithAverage()
- calculateBsToDollar(bs: number)
- calculateDollarToBs(dollar: number)
* Funciones para valores de euros:
- getEuroPrices()
- getEuroPricesWithAverage()
- calculateBsToEuro(bs: number)
- calculateEuroToBs(euro: number)
- Funciones para valores de dólares:

* getDollarPrices()
* getDollarPricesWithAverage()
* calculateBsToDollar(bs: number)
* calculateDollarToBs(dollar: number)

- Funciones para valores de euros:

* getEuroPrices()
* getEuroPricesWithAverage()
* calculateBsToEuro(bs: number)
* calculateEuroToBs(euro: number)

#### Funciones para valores de dólares

Expand Down Expand Up @@ -284,7 +284,7 @@ De forma similar a getEuroPrices(), esta función devuelve dos posibles valores.
"difference": 0.01,
"differencePercentage": "0.02%",
"tendency": "Uptrend",
"tendencyColor": "green"
"tendencyColor": "green"
}
},
{
Expand Down Expand Up @@ -330,7 +330,7 @@ Esta función representaría el cálculo similar al función calculateBsToEuro p
Del mismo modo, el paquete fue diseñado utilizando TypeScript, por lo que es posible hacer uso de la tipificación de funciones. Para ello, es necesario importar los tipos de datos directamente desde su carpeta:

```TypeScript
import { DollarType, DollarArrayType, EntityType, DollarAverageType } from 'venecodollar/src/types/DollarType'
import { DollarType, DollarArrayType, EntityType, DollarAverageType } from 'venecodollar/src/types/DollarType'
```

O
Expand Down Expand Up @@ -543,10 +543,10 @@ Este endpoint permite obtener todas las entidades de seguimiento del euro por el
GET /api/v2/dollar/toBs?dollar=${dollar}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------- |
| `dollar` | `number` | **Required**. Monto en dólares a ser calculado en bolívares. |
| `entity` | `string` | Nombre de entidades a obtener |
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------------------------- |
| `dollar` | `number` | **Required**. Monto en dólares a ser calculado en bolívares. |
| `entity` | `string` | Nombre de entidades a obtener |
Este endpoint permite obtener todas las entidades de monitoreo de dólares calculando el valor del dólar pasado como parámetro en la ruta en términos de bolívares. Si se pasa como parámetro en la ruta el nombre de una entidad por la cual se desea filtrar, el endpoint devolverá sólo las entidades de monitoreo de dólares que coincidan con el parámetro pasado.
Expand All @@ -556,10 +556,10 @@ Este endpoint permite obtener todas las entidades de monitoreo de dólares calcu
GET /api/v2/euro/toBs?euro=${euro}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------- |
| `euro` | `number` | **Required**. Monto en euros a ser calculado en bolívares. |
| `entity` | `string` | Nombre de entidades a obtener |
| Parameter | Type | Description |
| :-------- | :------- | :--------------------------------------------------------- |
| `euro` | `number` | **Required**. Monto en euros a ser calculado en bolívares. |
| `entity` | `string` | Nombre de entidades a obtener |
Este endpoint permite obtener todas las entidades de monitoreo de euros calculando el valor del euro pasado como parámetro en la ruta en términos de bolívares. Si se pasa como parámetro en la ruta el nombre de una entidad por la cual se desea filtrar, el endpoint devolverá sólo las entidades de monitoreo de dólares que coincidan con el parámetro pasado.
Expand All @@ -569,10 +569,10 @@ Este endpoint permite obtener todas las entidades de monitoreo de euros calculan
GET /api/v2/dollar/toDollar?bs=${bs}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------- |
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------------------------- |
| `bs` | `number` | **Required**. Monto en bolívares a ser calculado en dólares. |
| `entity` | `string` | Nombre de entidades a obtener. |
| `entity` | `string` | Nombre de entidades a obtener. |
Este endpoint permite obtener todas las entidades de monitoreo de dólares calculando el valor del dólar pasado como parámetro en la ruta en términos de bolívares. Si se pasa como parámetro en la ruta el nombre de una entidad por la cual se desea filtrar, el endpoint devolverá sólo las entidades de monitoreo de dólares que coincidan con el parámetro pasado.
Expand All @@ -582,10 +582,10 @@ Este endpoint permite obtener todas las entidades de monitoreo de dólares calcu
GET /api/v2/euro/toEuro?bs=${bs}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :----------------------------------------- |
| Parameter | Type | Description |
| :-------- | :------- | :--------------------------------------------------------- |
| `bs` | `number` | **Required**. Monto en bolívares a ser calculado en euros. |
| `entity` | `string` | Nombre de entidades a obtener. |
| `entity` | `string` | Nombre de entidades a obtener. |
Este endpoint permite obtener todas las entidades de monitoreo de euros calculando el valor del euro pasado como parámetro en la ruta en términos de bolívares. Si se pasa como parámetro en la ruta el nombre de una entidad por la cual se desea filtrar, el endpoint devolverá sólo las entidades de monitoreo de dólares que coincidan con el parámetro pasado.
Expand All @@ -600,4 +600,5 @@ Por favor, asegúrese de actualizar las pruebas según corresponda.
[MIT](https://choosealicense.com/licenses/mit/)
---
⌨️ hecho con ❤️ por [gustavoerivero](https://github.com/gustavoerivero)
⌨️ hecho con ❤️ por [gustavoerivero](https://github.com/gustavoerivero)
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ import * as Venecodollar from "venecodollar"
Or

```TypeScript
const {
getDollarPrices,
getDollarPricesWithAverage,
calculateBsToDollar,
const {
getDollarPrices,
getDollarPricesWithAverage,
calculateBsToDollar,
calculateDollarToBs,
getEuroPrices,
getEuroPricesWithAverage,
Expand Down Expand Up @@ -103,19 +103,19 @@ const getAverage = () => {

The package has at its disposal eight (8) functions, four (4) to dollar values and four (4) to euro values:

* Dollar functions:
- getDollarPrices()
- getDollarPricesWithAverage()
- calculateBsToDollar(bs: number)
- calculateDollarToBs(dollar: number)
* Euro functions:
- getEuroPrices()
- getEuroPricesWithAverage()
- calculateBsToEuro(bs: number)
- calculateEuroToBs(euro: number)
- Dollar functions:

* getDollarPrices()
* getDollarPricesWithAverage()
* calculateBsToDollar(bs: number)
* calculateDollarToBs(dollar: number)

- Euro functions:

* getEuroPrices()
* getEuroPricesWithAverage()
* calculateBsToEuro(bs: number)
* calculateEuroToBs(euro: number)

#### Dollar functions

Expand Down Expand Up @@ -282,7 +282,7 @@ Similarly to getEuroPrices(), this function returns two possible values. In case
"difference": 0.01,
"differencePercentage": "0.02%",
"tendency": "Uptrend",
"tendencyColor": "green"
"tendencyColor": "green"
}
},
{
Expand Down Expand Up @@ -328,7 +328,7 @@ This function would represent the calculation similar to the calculateBsToEuro f
Likewise, the package was designed using TypeScript, so it is possible to make use of function typing. To do so, it is necessary to import the data types directly from your folder:

```TypeScript
import { TDollar, TDollarEntity, TDollarAverage, TDollarCalculated, TBsCalculated, TDollarCalculatedAverage, TBsCalculatedAverage } from 'venecodollar/src/types/DollarType'
import { TDollar, TDollarEntity, TDollarAverage, TDollarCalculated, TBsCalculated, TDollarCalculatedAverage, TBsCalculatedAverage } from 'venecodollar/src/types/DollarType'
```

Or
Expand Down Expand Up @@ -554,10 +554,10 @@ This endpoint allows obtaining all the dollar monitoring entities while calculat
GET /api/v2/euro/toBs?euro=${euro}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :------------------------------------------------------------ |
| `euro` | `number` | **Required**. Amount in euros to be calculated in bolivars. |
| `entity` | `string` | Name of entities to fetch |
| Parameter | Type | Description |
| :-------- | :------- | :---------------------------------------------------------- |
| `euro` | `number` | **Required**. Amount in euros to be calculated in bolivars. |
| `entity` | `string` | Name of entities to fetch |
This endpoint allows obtaining all the euro monitoring entities while calculating the value of the euro passed as a parameter in the path in terms of bolivars. If the name of an entity to be filtered by is passed as a parameter in the path, the endpoint will return only the dollar monitoring entities that match the parameter passed.
Expand All @@ -580,10 +580,10 @@ This endpoint allows obtaining all the dollar monitoring entities while calculat
GET /api/v2/euro/toEuro?bs=${bs}&entity={entity}
```
| Parameter | Type | Description |
| :-------- | :------- | :------------------------------------------------------------ |
| Parameter | Type | Description |
| :-------- | :------- | :---------------------------------------------------------- |
| `bs` | `number` | **Required**. Amount in bolivars to be calculated in euros. |
| `entity` | `string` | Name of entities to fetch |
| `entity` | `string` | Name of entities to fetch |
This endpoint allows obtaining all the euro monitoring entities while calculating the value of the euro passed as a parameter in the path in terms of bolivars. If the name of an entity to be filtered by is passed as a parameter in the path, the endpoint will return only the dollar monitoring entities that match the parameter passed.
Expand All @@ -598,4 +598,5 @@ Please make sure to update tests as appropriate.
[MIT](https://choosealicense.com/licenses/mit/)
---
⌨️ made with ❤️ by [gustavoerivero](https://github.com/gustavoerivero)
⌨️ made with ❤️ by [gustavoerivero](https://github.com/gustavoerivero)
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};
26 changes: 26 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...compat.extends('plugin:@typescript-eslint/recommended'),
{
languageOptions: {
parser: tsParser,
ecmaVersion: 2018,
sourceType: 'module',
},

rules: {},
},
];
Loading

0 comments on commit f42146b

Please sign in to comment.