Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge para despliegue - Tercera entrega #92

Merged
merged 122 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
2cc71cd
No permitir usuario repetido
Rodrox11 Apr 1, 2024
427bb24
Implementar las rutas
Rodrox11 Apr 4, 2024
f7b6003
Consulta de usuarios
Rodrox11 Apr 4, 2024
8d3e359
Lista de usuarios
Rodrox11 Apr 4, 2024
137b507
Implementar correcto funcionamiento de busqueda
Rodrox11 Apr 4, 2024
89c05cf
Prototipo básico implementado
CANCI0 Apr 4, 2024
0b1ab3c
Arreglado bug con raíces negativas
CANCI0 Apr 4, 2024
407c1a7
Añadidos tests unitarios
CANCI0 Apr 4, 2024
40e4e1a
Arreglado bug de división de 0
CANCI0 Apr 4, 2024
b5188a6
Merge pull request #84 from Arquisoft/83-modo-de-juego-calculadora-hu…
iyanfdezz Apr 5, 2024
b5fba54
Actualizar rutas y navegación
Rodrox11 Apr 5, 2024
d3400fd
Rutas relativas + fondo de partículas
CANCI0 Apr 5, 2024
a13ea32
Implementar amigo
Rodrox11 Apr 5, 2024
2058e9c
Modificar UserPage para aceptar amigos
Rodrox11 Apr 5, 2024
b17c200
Añadir amigos en la api
Rodrox11 Apr 5, 2024
c8ca8bd
Implementar api para group
Rodrox11 Apr 5, 2024
50bd00b
Guardado de partida del modo Calculadora
iyanfdezz Apr 5, 2024
430ecab
Crear grupos
Rodrox11 Apr 5, 2024
2369b8d
añadir grupos al modelo
Rodrox11 Apr 5, 2024
79a5dba
Implementar Lista de amigos
Rodrox11 Apr 5, 2024
a388985
Modificada la vista de estadísticaas para las stats de Calculadora
iyanfdezz Apr 5, 2024
33cb9a6
Modificada la vista de ranking para calculadora
iyanfdezz Apr 5, 2024
7e69608
Arreglos en el guardado de partida
iyanfdezz Apr 5, 2024
3439715
Ya se guardan las partidas bien
iyanfdezz Apr 5, 2024
842e56c
Ajustes en la interfaz de Perfil
iyanfdezz Apr 5, 2024
e8e3529
Ajustes en el filtrado de Ranking
iyanfdezz Apr 5, 2024
153fe58
Añadido return null que si no obviamente no va
iyanfdezz Apr 5, 2024
07935ce
Arreglo en el calculo de tiempo
iyanfdezz Apr 5, 2024
a573e15
Merge pull request #88 from Arquisoft/85-añadir-fondo-con-partículas
iyanfdezz Apr 5, 2024
504866f
Tests arreglados
CANCI0 Apr 5, 2024
417d562
Merge pull request #89 from Arquisoft/stats-calculadora
CANCI0 Apr 5, 2024
824d94d
Merge pull request #90 from Arquisoft/85-añadir-fondo-con-partículas
CANCI0 Apr 5, 2024
dff741e
Creada estructura para la internacionalización
CANCI0 Apr 5, 2024
1d93a86
Añadido test de perfil para calculadora
iyanfdezz Apr 5, 2024
9b3aaf0
Login register y Nav internacionalizados
CANCI0 Apr 5, 2024
e85dab2
Añadido test de Ranking y Stats para calculadora
iyanfdezz Apr 5, 2024
9f2caf9
Batería y calculadora internacionalizados
CANCI0 Apr 5, 2024
ef4458d
Merge pull request #91 from Arquisoft/stats-calculadora
iyanfdezz Apr 5, 2024
3645a8c
Clásico, config y Home internacionalizados
CANCI0 Apr 5, 2024
050917e
Todo internacionalizado
CANCI0 Apr 5, 2024
50d769a
modificar grupo
Rodrox11 Apr 5, 2024
dc478dc
modificacion de userPage
Rodrox11 Apr 5, 2024
9e2c5bb
Ahora en las plantillas se reemplaza en vez de concatenar
CANCI0 Apr 6, 2024
0e8fd8e
Merge branch 'develop' into Social
iyanfdezz Apr 6, 2024
2f2fbe2
Merge branch 'Social' of https://github.com/Arquisoft/wiq_es1a into S…
iyanfdezz Apr 6, 2024
0e5298e
Haciendo que las peticiones pasen por el gateway service
iyanfdezz Apr 6, 2024
92aff9c
Preguntas internacionalizadas
CANCI0 Apr 6, 2024
92be1d0
Arreglado error en la solicitud
CANCI0 Apr 6, 2024
fcfcb17
Arreglando el modelo de usuarios
iyanfdezz Apr 6, 2024
9b9606f
Modificando el users page
iyanfdezz Apr 6, 2024
7a8fb37
Cambiando las vistas a Chakra UI
iyanfdezz Apr 6, 2024
7312d48
Ya se ven las vistas por lo menos
iyanfdezz Apr 6, 2024
0ec374c
Pasa todo menos stats
CANCI0 Apr 6, 2024
bc01403
Solo queda un test
CANCI0 Apr 6, 2024
5981137
Tocando mas cosas
iyanfdezz Apr 6, 2024
3eb1183
Pasa todo
CANCI0 Apr 6, 2024
365eadb
Merge branch 'develop' into 10-internacionalización-y-generación-de-p…
CANCI0 Apr 6, 2024
31589a0
Merge pull request #93 from Arquisoft/10-internacionalización-y-gener…
CANCI0 Apr 6, 2024
4cb6024
Ya funciona la vista de añadir amigos
iyanfdezz Apr 6, 2024
ec597e5
Ahora los que ya son amigos no se muestran
iyanfdezz Apr 6, 2024
bb70941
Arreglos
iyanfdezz Apr 6, 2024
0310029
Arreglando la lista de amigos
iyanfdezz Apr 6, 2024
9450864
Sigue sin mostrar los amigos no se por que
iyanfdezz Apr 6, 2024
4ef5a8a
Ya debería ir
iyanfdezz Apr 6, 2024
c56a8eb
Fix de import
CANCI0 Apr 6, 2024
9d06b01
Ahora se muestran correctamente los amigos
CANCI0 Apr 6, 2024
b3ba3f2
Ahora se muestran los perfiles de los amigos
CANCI0 Apr 6, 2024
8284bef
Estilo de la lista de amigos actualizado
CANCI0 Apr 6, 2024
5e1fc06
Ahora los avatares se muestran en el perfil
CANCI0 Apr 6, 2024
fb6d6d9
Se ha añadido borrado de amigos
CANCI0 Apr 6, 2024
226bd77
Ya se eliminan los amigos
CANCI0 Apr 6, 2024
b260af8
Borrada lógica de grupos
CANCI0 Apr 6, 2024
7ead61c
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
CANCI0 Apr 6, 2024
f73a40e
Pequeños errores
CANCI0 Apr 6, 2024
1afe0a9
Internacionalización de los nuevos componentes
CANCI0 Apr 6, 2024
069c168
Mensajes en inglés actualizados
CANCI0 Apr 6, 2024
07f7825
Componente Perfil internacionalizado
CANCI0 Apr 6, 2024
b28d9fa
Tests arreglados
CANCI0 Apr 6, 2024
7e19eb9
Merge pull request #95 from Arquisoft/94-añadir-sistema-de-amistades
CANCI0 Apr 6, 2024
964ec70
Tests funcionando
CANCI0 Apr 6, 2024
9cc53e7
Tests de FriendsList
CANCI0 Apr 7, 2024
d8e0563
Falala un test de userpage
CANCI0 Apr 7, 2024
da41c26
Arreglado test de UsersPage
iyanfdezz Apr 7, 2024
9dc4dea
Eliminando codigo duplicado
iyanfdezz Apr 7, 2024
a5014b8
Avances
CANCI0 Apr 7, 2024
a2dbfc9
Documentación actualizada menos /adduser
CANCI0 Apr 7, 2024
1e6f02a
Rutas documentadas, menos las nuevas
CANCI0 Apr 7, 2024
ddede46
Todas las rutas documentadas
CANCI0 Apr 7, 2024
c5e1804
Merge pull request #100 from Arquisoft/97-mejorar-documentación-openapi
CANCI0 Apr 7, 2024
b3108f6
Extrayendo código duplicado
CANCI0 Apr 7, 2024
d9aa210
Menos código duplicado
CANCI0 Apr 7, 2024
ec95370
Tests arreglados
CANCI0 Apr 7, 2024
624852d
Pasan
CANCI0 Apr 7, 2024
9bca156
Más fixes
CANCI0 Apr 7, 2024
430e8b6
Merge pull request #98 from Arquisoft/96-realizar-pruebas-de-la-funci…
CANCI0 Apr 7, 2024
9d9b5eb
Background no se puede probar
CANCI0 Apr 7, 2024
36a2c5c
Añadiendo coverage
iyanfdezz Apr 7, 2024
4dc0f6b
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
iyanfdezz Apr 7, 2024
36e4e5b
Añadiendo coverage a Nav
iyanfdezz Apr 7, 2024
09d8502
Añadiendo coverage a gateway service
iyanfdezz Apr 7, 2024
5e96d2a
Aumentando coverage de stats
iyanfdezz Apr 7, 2024
b4896fa
Aumentando coverage en Register
iyanfdezz Apr 7, 2024
e0d0ae8
Aumentando el coverage
CANCI0 Apr 7, 2024
e57ec3e
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
CANCI0 Apr 7, 2024
cc5c6fd
Más coverage
CANCI0 Apr 7, 2024
2afc0ec
Más coverage para Nav
iyanfdezz Apr 7, 2024
63115ae
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
iyanfdezz Apr 7, 2024
f5a380e
Más coverage en Config
CANCI0 Apr 7, 2024
5b6a44a
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
CANCI0 Apr 7, 2024
8b6bf08
Más cambios
CANCI0 Apr 7, 2024
4420e46
Más coverage para Stats
iyanfdezz Apr 7, 2024
aca33d4
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
iyanfdezz Apr 7, 2024
02d31ae
Más coverage en Ranking
CANCI0 Apr 7, 2024
45a003f
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
CANCI0 Apr 7, 2024
5e656d7
Eliminando codigo duplicado de gateway service
iyanfdezz Apr 7, 2024
4df384e
Merge branch 'develop' of https://github.com/Arquisoft/wiq_es1a into …
iyanfdezz Apr 7, 2024
7aef31c
Cancelamos
iyanfdezz Apr 7, 2024
0a07399
Shhh
CANCI0 Apr 7, 2024
03760f0
Revertimos
CANCI0 Apr 7, 2024
e4586cf
Más arreglos
CANCI0 Apr 7, 2024
deebe59
Ahora se prueba cuando las contraseñas son diferentes
CANCI0 Apr 7, 2024
1735c89
Fix
CANCI0 Apr 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions gatewayservice/error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
port: 8001,
address: '127.0.0.1',
syscall: 'connect',
code: 'ECONNREFUSED',
errno: -4078,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: null },
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json, text/plain, \*/\*',
'Content-Type': undefined,
'User-Agent': 'axios/1.6.5',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
params: { username: 'admin' },
method: 'get',
url: 'http://localhost:8001/users/search',
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError],
socket: [Function: handleRequestSocket]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
maxRedirects: 21,
maxBodyLength: Infinity,
protocol: 'http:',
path: '/users/search?username=admin',
method: 'GET',
headers: [Object: null prototype],
agents: [Object],
auth: undefined,
family: undefined,
beforeRedirect: [Function: dispatchBeforeRedirect],
beforeRedirects: [Object],
hostname: 'localhost',
port: '8001',
agent: undefined,
nativeProtocols: [Object],
pathname: '/users/search',
search: '?username=admin'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: [Socket],
_header: 'GET /users/search?username=admin HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/1.6.5\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: localhost:8001\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/users/search?username=admin',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'localhost',
protocol: 'http:',
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kEndCalled)]: true,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'http://localhost:8001/users/search?username=admin',
[Symbol(kCapture)]: false
},
cause: Error: connect ECONNREFUSED 127.0.0.1:8001
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8001
}
}
53 changes: 53 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ app.get("/health", (req, res) => {
});

returnError = (res, error) => {
console.log(error);
res.status(error.response.status).json({ error: error.response.data.error });
}

Expand Down Expand Up @@ -81,6 +82,58 @@ app.post("/saveGameList", async (req, res) => {
}
});

app.get("/friends", async (req, res) => {
try {
// Forward the question request to the user service
const userResponse = await axios.get(
userServiceUrl + "/friends",
{ params: req.query }
);
res.json(userResponse.data);
} catch (error) {
returnError(res, error);
}
});

app.get("/users/search", async (req, res) => {
try {
// Forward the question request to the user service
const userResponse = await axios.get(
userServiceUrl + "/users/search",
{ params: req.query }
);
res.json(userResponse.data);
} catch (error) {
returnError(res, error);
}
});

app.post("/users/add-friend", async (req, res) => {
try {
// Forward the save game request to the stats service
const gameResponse = await axios.post(
userServiceUrl + "/users/add-friend",
req.body
);
res.json(gameResponse.data);
} catch (error) {
returnError(res, error);
}
});

app.post("/users/remove-friend", async (req, res) => {
try {
// Forward the save game request to the stats service
const gameResponse = await axios.post(
userServiceUrl + "/users/remove-friend",
req.body
);
res.json(gameResponse.data);
} catch (error) {
returnError(res, error);
}
});

app.get("/questions", async (req, res) => {
try {
// Forward the question request to the question service
Expand Down
40 changes: 40 additions & 0 deletions gatewayservice/gateway-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,44 @@ describe("Gateway Service", () => {
expect(response.statusCode).toBe(200);
expect(response.body).toEqual({ saved: true });
});

// Prueba para la ruta /friends
it("should forward friends request to user service", async () => {
axios.get.mockResolvedValueOnce({ data: { friends: ["friend1", "friend2"] } });

const response = await request(app).get("/friends").query({ userId: "testuser" });

expect(response.statusCode).toBe(200);
expect(response.body).toEqual({ friends: ["friend1", "friend2"] });
});

// Prueba para la ruta /users/search
it("should forward search users request to user service", async () => {
axios.get.mockResolvedValueOnce({ data: { users: ["user1", "user2"] } });

const response = await request(app).get("/users/search").query({ query: "test" });

expect(response.statusCode).toBe(200);
expect(response.body).toEqual({ users: ["user1", "user2"] });
});

// Prueba para la ruta /users/add-friend
it("should forward add friend request to user service", async () => {
axios.post.mockResolvedValueOnce({ data: { success: true } });

const response = await request(app).post("/users/add-friend").send({ userId: "user1", friendId: "user2" });

expect(response.statusCode).toBe(200);
expect(response.body).toEqual({ success: true });
});

// Prueba para la ruta /users/remove-friend
it("should forward remove friend request to user service", async () => {
axios.post.mockResolvedValueOnce({ data: { success: true } });

const response = await request(app).post("/users/remove-friend").send({ userId: "user1", friendId: "user2" });

expect(response.statusCode).toBe(200);
expect(response.body).toEqual({ success: true });
});
});
Loading
Loading