Skip to content

Commit 82aa220

Browse files
Add different types of filters(insights) using d3.js
1 parent 83e2677 commit 82aa220

32 files changed

+2488
-403
lines changed

package-lock.json

Lines changed: 445 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
"@testing-library/react": "^16.2.0",
99
"@testing-library/user-event": "^13.5.0",
1010
"axios": "^1.8.4",
11+
"d3": "^7.9.0",
1112
"react": "^19.0.0",
1213
"react-dom": "^19.0.0",
1314
"react-native": "^0.78.1",
1415
"react-router-dom": "^7.4.0",
1516
"react-scripts": "^5.0.1",
16-
"styled-components": "^6.1.15",
17+
"styled-components": "^6.1.16",
1718
"styled-system": "^5.1.5",
1819
"web-vitals": "^2.1.4"
1920
},

src/api/usuario/administrador.js renamed to src/api/usuario.js

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from "axios";
2-
import { BASE_URL } from "../../config/config.js";
2+
import { BASE_URL } from "../config/config.js";
33

4-
const ADMIN_API = `${BASE_URL}/administrador`;
4+
const USUARIO_API = `${BASE_URL}/usuario`;
55

66
/**
77
* Consulta usuarios con filtros opcionales.
@@ -14,7 +14,7 @@ const ADMIN_API = `${BASE_URL}/administrador`;
1414
*/
1515
export async function consultarUsuarios(filtros) {
1616
try {
17-
const response = await axios.get(`${ADMIN_API}/usuarios`, { params: filtros });
17+
const response = await axios.get(`${USUARIO_API}/usuarios`, { params: filtros });
1818
return response.data;
1919
} catch (error) {
2020
throw new Error(error.response.data.message);
@@ -30,7 +30,7 @@ export async function consultarUsuarios(filtros) {
3030
export async function consultarUsuarioPorCorreo(correo) {
3131
try {
3232
// Verifica la ruta y el parámetro "correo"
33-
const response = await axios.get(`${ADMIN_API}/usuarioPorCorreo`, {
33+
const response = await axios.get(`${USUARIO_API}/usuarioPorCorreo`, {
3434
params: { correo: correo },
3535
});
3636
return response.data;
@@ -47,7 +47,7 @@ export async function consultarUsuarioPorCorreo(correo) {
4747
*/
4848
export async function agregarUsuario(usuario) {
4949
try {
50-
const response = await axios.post(`${ADMIN_API}/usuario`, usuario);
50+
const response = await axios.post(`${USUARIO_API}/usuario`, usuario);
5151
return response.data;
5252
} catch (error) {
5353
throw new Error(error.response.data.message);
@@ -63,7 +63,7 @@ export async function agregarUsuario(usuario) {
6363
*/
6464
export async function actualizarInformacionUsuario(id, actualizacion) {
6565
try {
66-
const response = await axios.patch(`${ADMIN_API}/usuario/${id}`, actualizacion);
66+
const response = await axios.patch(`${USUARIO_API}/usuario/${id}`, actualizacion);
6767
return response.data;
6868
} catch (error) {
6969
throw new Error(error.response.data.message);
@@ -79,7 +79,7 @@ export async function actualizarInformacionUsuario(id, actualizacion) {
7979
*/
8080
export async function agregarSalon(id, salon) {
8181
try {
82-
const response = await axios.post(`${ADMIN_API}/${id}/salon`, salon);
82+
const response = await axios.post(`${USUARIO_API}/${id}/salon`, salon);
8383
return response.data;
8484
} catch (error) {
8585
throw new Error(error.response.data.message);
@@ -95,7 +95,35 @@ export async function agregarSalon(id, salon) {
9595
*/
9696
export async function crearReserva(id, reserva) {
9797
try {
98-
const response = await axios.post(`${ADMIN_API}/${id}/reserva`, reserva);
98+
const response = await axios.post(`${USUARIO_API}/${id}/reserva`, reserva);
99+
return response.data;
100+
} catch (error) {
101+
throw new Error(error.response.data.message);
102+
}
103+
}
104+
105+
/**
106+
* Consulta un usuario por su ID.
107+
* @param {number} id - ID del usuario a consultar.
108+
* @returns {Promise<Object>} - Datos del usuario.
109+
*/
110+
export async function consultarUsuario(id) {
111+
try {
112+
const response = await axios.get(`${USUARIO_API}/${id}`);
113+
return response.data;
114+
} catch (error) {
115+
throw new Error(error.response.data.message);
116+
}
117+
}
118+
119+
/**
120+
* Lista todas las reservas de un usuario.
121+
* @param {number} id - ID del usuario.
122+
* @returns {Promise<Object[]>} - Lista de reservas.
123+
*/
124+
export async function listarReservas(id) {
125+
try {
126+
const response = await axios.get(`${USUARIO_API}/${id}/reserva`);
99127
return response.data;
100128
} catch (error) {
101129
throw new Error(error.response.data.message);

src/api/usuario/estandar.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/components/Admin/ChartSection.js

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)