From 6c3a2a40d25076871c89bd6ce0ce9c1922b733d3 Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 20:42:09 +0200 Subject: [PATCH 1/9] =?UTF-8?q?Eliminaci=C3=B3n=20de=20parte=20del=20codig?= =?UTF-8?q?o=20duplicado=20y=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- restapi/api.ts | 4 ++-- restapi/tests/UserManager.test.ts | 1 - restapi/tests/api.test.ts | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/restapi/api.ts b/restapi/api.ts index 87e0f88..d1044cb 100644 --- a/restapi/api.ts +++ b/restapi/api.ts @@ -2,7 +2,7 @@ import express, { Request, Response, Router } from 'express'; import * as fac from './src/facade'; const api: Router = express.Router() - +/* api.get( "/usermanager/find/username", async (req: Request, res: Response): Promise => { @@ -14,7 +14,7 @@ api.get( return res.status(404).send({ "error": err.message }) } } -); +);*/ api.post( "/usermanager/edit", diff --git a/restapi/tests/UserManager.test.ts b/restapi/tests/UserManager.test.ts index 79605d0..439bfc3 100644 --- a/restapi/tests/UserManager.test.ts +++ b/restapi/tests/UserManager.test.ts @@ -121,7 +121,6 @@ describe('UserManager', () => { }); it('no deberia lanzar ningun error si cambia la contraseña satisfactoriamente (se cambia por la misma por ser un test)', async () => { - let error = new Error("Error por defecto") try { await userManager.modificarContrasena(new UserImpl("usertestn4", "", "", ""), "usertestN4.", "usertestN4.") } catch (err) { diff --git a/restapi/tests/api.test.ts b/restapi/tests/api.test.ts index 0662008..aa6386c 100644 --- a/restapi/tests/api.test.ts +++ b/restapi/tests/api.test.ts @@ -2,16 +2,17 @@ import express, { Application, RequestHandler } from "express"; import bp from "body-parser"; import promBundle from "express-prom-bundle"; import { Server } from "http"; -import request, { Response } from "supertest"; +import request from "supertest"; import apiUser from "../api"; import { UserImpl } from "../src/entities/User"; import { FriendRequest } from "../src/entities/FriendRequest"; import { FriendManagerImpl } from "../src/controllers/FriendManager"; import FriendshipSchema from "../src/entities/FriendshipSchema"; import UserSchema from "../src/entities/UserSchema"; -var mongoose = require('mongoose'); -var server: Server; +const mongoose = require('mongoose'); + +let server: Server; const app: Application = express(); @@ -46,7 +47,7 @@ describe('test conexión con api ', () => { expect(response.status).toBe(200); }); }); - +/* describe('/usermanager/find/username ', () => { test('usuario que existe', async () => { const response = await request(app).get('/usermanager/find/username?username=usertestn1'); @@ -59,7 +60,7 @@ describe('/usermanager/find/username ', () => { const response = await request(app).get('/usermanager/find/username?username=usernotexists'); expect(response.status).toBe(404); }); -}); +});*/ describe('/usermanager/edit ', () => { test('usuario que existe', async () => { @@ -88,7 +89,7 @@ describe('/sesionmanager/signup ', () => { let user = new UserImpl("usertestsignup", "1234", "webIdPrueba", "descripcionprueba", "img") const response = await request(app).post('/sesionmanager/signup').send({ user: user }); expect(response.status).toBe(200); - let r = await UserSchema.deleteOne({ username: "usertestsignup" }) + await UserSchema.deleteOne({ username: "usertestsignup" }) }); }); From 634561fe3654b22a8cb309b935f97c5d7dc0238e Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 20:49:54 +0200 Subject: [PATCH 2/9] =?UTF-8?q?Eliminaci=C3=B3n=20de=20parte=20del=20codig?= =?UTF-8?q?o=20duplicado=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- restapi/tests/UserManager.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/restapi/tests/UserManager.test.ts b/restapi/tests/UserManager.test.ts index 439bfc3..33c2a69 100644 --- a/restapi/tests/UserManager.test.ts +++ b/restapi/tests/UserManager.test.ts @@ -100,13 +100,13 @@ describe('UserManager', () => { }); describe('modificarContrasena', () => { it('debería lanzar un error si el usuario no existe', async () => { - let error = new Error("Error por defecto") + let error1 = new Error("Error por defecto") try { await userManager.modificarContrasena(new UserImpl("usertestnotexists", "", "", ""), "", "") } catch (err) { - error = err; + error1 = err; } - expect(error.message).toBe("El usuario no existe."); + expect(error1.message).toBe("El usuario no existe."); }); it('debería lanzar un error si la contraseña antigua no coincide', async () => { From a09520623ea8374e64c762e367a11686cf49e6b0 Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 20:51:37 +0200 Subject: [PATCH 3/9] =?UTF-8?q?Eliminaci=C3=B3n=20de=20parte=20del=20codig?= =?UTF-8?q?o=20duplicado=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- restapi/tests/api.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restapi/tests/api.test.ts b/restapi/tests/api.test.ts index aa6386c..b3dea51 100644 --- a/restapi/tests/api.test.ts +++ b/restapi/tests/api.test.ts @@ -113,8 +113,8 @@ describe('/sesionmanager/login ', () => { test('usuario que no existe', async () => { - let user = new UserImpl("usernotexists", "wrongpassword", "webIdPrueba1", "descripcionprueba1") - const response = await request(app).post('/sesionmanager/login').send({ user: user }); + let userNotExist = new UserImpl("usernotexists", "wrongpassword", "webIdPrueba1", "descripcionprueba1") + const response = await request(app).post('/sesionmanager/login').send({ user: userNotExist }); expect(response.status).toBe(404); }); From af23fcdfea33d3ea6fa4804628569cfe355a0f31 Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 21:03:22 +0200 Subject: [PATCH 4/9] Cambio para sonar --- restapi/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restapi/package.json b/restapi/package.json index 261a362..588ea39 100644 --- a/restapi/package.json +++ b/restapi/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "scripts": { "start": "ts-node-dev ./server.ts", - "test": "cd tests && jest --runInBand" + "test": "cd tests && jest --coverage" }, "keywords": [], "author": "", From deca12ccab64aebc6f32ab68f034269299a8a464 Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 21:16:08 +0200 Subject: [PATCH 5/9] =?UTF-8?q?Quitado=20mas=20c=C3=B3digo=20duplicado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- restapi/tests/api.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/restapi/tests/api.test.ts b/restapi/tests/api.test.ts index b3dea51..8a9902b 100644 --- a/restapi/tests/api.test.ts +++ b/restapi/tests/api.test.ts @@ -236,14 +236,14 @@ describe('/usermanager/editpsw', () => { describe('/friendmanager/friendrequests', () => { test('user que existe', async () => { - let user = new UserImpl("usertestn1", "", "webIdPrueba1", "descripcionprueba1") - const response = await request(app).post('/friendmanager/friendrequests').send({ user: user }); - expect(response.status).toBe(200); + let user2 = new UserImpl("usertestn1", "", "webIdPrueba1", "descripcionprueba1") + const response2 = await request(app).post('/friendmanager/friendrequests').send({ user: user2 }); + expect(response2.status.toString()).toBe("200"); }); test('user que no existe', async () => { - let user = new UserImpl("usernotexists", "", "webIdPrueba1", "descripcionprueba1") - const response = await request(app).post('/friendmanager/friendrequests').send({ user: user }); - expect(response.status).toBe(404); + let user3 = new UserImpl("usernotexists", "", "webIdPrueba1", "descripcionprueba1") + const response2 = await request(app).post('/friendmanager/friendrequests').send({ user: user3 }); + expect(response2.status.toString()).toBe("404"); }); }); From 37e53a140e56fb3bc6476d63207149fc6b47bdb9 Mon Sep 17 00:00:00 2001 From: uo282154 Date: Sat, 29 Apr 2023 22:20:25 +0200 Subject: [PATCH 6/9] Probando para el coverage para sonar --- restapi/package.json | 13 +++++++++++++ restapi/tests/jest.config.ts | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/restapi/package.json b/restapi/package.json index 588ea39..7f7c1bb 100644 --- a/restapi/package.json +++ b/restapi/package.json @@ -5,6 +5,19 @@ "start": "ts-node-dev ./server.ts", "test": "cd tests && jest --coverage" }, + + "jest": { + "collectCoverage": true, + "coverageReporters": [ + "json", + "lcov", + "text", + "clover" + ], + "coverageDirectory": "coverage" + } + + , "keywords": [], "author": "", "license": "ISC", diff --git a/restapi/tests/jest.config.ts b/restapi/tests/jest.config.ts index 4679fbe..2a53ade 100644 --- a/restapi/tests/jest.config.ts +++ b/restapi/tests/jest.config.ts @@ -11,5 +11,12 @@ export default { "**/src/persistence/*.{ts,tsx}", "!**/src/persistence/DefaultMongo.ts", "**/src/entities/*.{ts,tsx}", - ] + ], + coverageReporters: [ + "json", + "lcov", + "text", + "clover" + ], + coverageDirectory: "coverage" } \ No newline at end of file From f88a2b6ecb0a23fd0ae33f69e2e40e9e78aeba04 Mon Sep 17 00:00:00 2001 From: uo269745 Date: Sat, 29 Apr 2023 22:39:10 +0200 Subject: [PATCH 7/9] trying to use https --- docker-compose-deploy.yml | 2 +- docker-compose.yml | 2 +- webapp/public/{fotosCarrusel => }/1.PNG | Bin webapp/public/{fotosCarrusel => }/2.PNG | Bin webapp/public/{fotosCarrusel => }/3.PNG | Bin webapp/public/{fotosCarrusel => }/4.PNG | Bin webapp/public/{markers => }/add-location.png | Bin webapp/public/{markers => }/friendsMarker.png | Bin webapp/public/{markers => }/myMarker.png | Bin webapp/server.ts | 4 +--- webapp/src/api/api.ts | 1 - webapp/src/auth/AuthPodChecker.tsx | 1 - .../src/components/mainComponents/ImgCarrusel.tsx | 6 +++--- .../components/userIdentification/podLogin/Pod.tsx | 11 +++++------ .../windowComponents/friends/FriendsComponent.tsx | 2 +- .../windowComponents/groups/GroupsComponent.tsx | 2 +- .../windowComponents/map/MapComponent.tsx | 10 +++++----- .../places/placeViews/AddPlaceForm.tsx | 2 +- 18 files changed, 19 insertions(+), 24 deletions(-) rename webapp/public/{fotosCarrusel => }/1.PNG (100%) rename webapp/public/{fotosCarrusel => }/2.PNG (100%) rename webapp/public/{fotosCarrusel => }/3.PNG (100%) rename webapp/public/{fotosCarrusel => }/4.PNG (100%) rename webapp/public/{markers => }/add-location.png (100%) rename webapp/public/{markers => }/friendsMarker.png (100%) rename webapp/public/{markers => }/myMarker.png (100%) diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index 1a03c94..e37ceca 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -7,6 +7,6 @@ services: webapp: image: ghcr.io/arquisoft/lomap_es2c/webapp:latest ports: - - "3000:3000" + - "443:443" depends_on: - restapi diff --git a/docker-compose.yml b/docker-compose.yml index 8089399..e6b1aeb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: webapp: build: ./webapp ports: - - "3000:3000" + - "443:443" depends_on: - restapi prometheus: diff --git a/webapp/public/fotosCarrusel/1.PNG b/webapp/public/1.PNG similarity index 100% rename from webapp/public/fotosCarrusel/1.PNG rename to webapp/public/1.PNG diff --git a/webapp/public/fotosCarrusel/2.PNG b/webapp/public/2.PNG similarity index 100% rename from webapp/public/fotosCarrusel/2.PNG rename to webapp/public/2.PNG diff --git a/webapp/public/fotosCarrusel/3.PNG b/webapp/public/3.PNG similarity index 100% rename from webapp/public/fotosCarrusel/3.PNG rename to webapp/public/3.PNG diff --git a/webapp/public/fotosCarrusel/4.PNG b/webapp/public/4.PNG similarity index 100% rename from webapp/public/fotosCarrusel/4.PNG rename to webapp/public/4.PNG diff --git a/webapp/public/markers/add-location.png b/webapp/public/add-location.png similarity index 100% rename from webapp/public/markers/add-location.png rename to webapp/public/add-location.png diff --git a/webapp/public/markers/friendsMarker.png b/webapp/public/friendsMarker.png similarity index 100% rename from webapp/public/markers/friendsMarker.png rename to webapp/public/friendsMarker.png diff --git a/webapp/public/markers/myMarker.png b/webapp/public/myMarker.png similarity index 100% rename from webapp/public/markers/myMarker.png rename to webapp/public/myMarker.png diff --git a/webapp/server.ts b/webapp/server.ts index cdd3076..558d02e 100644 --- a/webapp/server.ts +++ b/webapp/server.ts @@ -3,11 +3,9 @@ import express, { Application } from 'express'; //setting the option module to commonjs var app: Application = express(); -const port: number = 3000; +const port: number = 443 | 3000; app.use(express.static("build")); -app.use(express.static('public')); -app.use(express.static(__dirname + '/public')); app .listen(port, (): void => { diff --git a/webapp/src/api/api.ts b/webapp/src/api/api.ts index bd3b38f..9ffa577 100644 --- a/webapp/src/api/api.ts +++ b/webapp/src/api/api.ts @@ -76,7 +76,6 @@ export async function editUserDetails(user: User): Promise { } export async function getMyFriends(user: User): Promise { - console.log("empieza") const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/api' let response = await fetch(apiEndPoint + '/friendmanager/friends', { method: 'POST', diff --git a/webapp/src/auth/AuthPodChecker.tsx b/webapp/src/auth/AuthPodChecker.tsx index f3fcf93..b44c90d 100644 --- a/webapp/src/auth/AuthPodChecker.tsx +++ b/webapp/src/auth/AuthPodChecker.tsx @@ -2,7 +2,6 @@ import { Navigate } from 'react-router-dom'; import { readCookie } from 'utils/CookieReader'; export const AuthPodChecker = (props: { children: any }) => { - console.log(readCookie("isPodLogged")) if (readCookie("isPodLogged") === "true") { return props.children; } else { diff --git a/webapp/src/components/mainComponents/ImgCarrusel.tsx b/webapp/src/components/mainComponents/ImgCarrusel.tsx index b2e3885..8e12448 100644 --- a/webapp/src/components/mainComponents/ImgCarrusel.tsx +++ b/webapp/src/components/mainComponents/ImgCarrusel.tsx @@ -46,15 +46,15 @@ export default function StandardImageList() { const itemData = [ { - img: '/fotosCarrusel/1.png', + img: '1.png', title: 'Crea tus propios mapas', }, { - img: '/fotosCarrusel/2.png', + img: '2.png', title: 'Guarda tus lugares favoritos', }, { - img: '/fotosCarrusel/4.png', + img: '4.png', title: 'Ve los mapas de tus amigos', } ]; \ No newline at end of file diff --git a/webapp/src/components/userIdentification/podLogin/Pod.tsx b/webapp/src/components/userIdentification/podLogin/Pod.tsx index 115b5f7..ecd76c2 100644 --- a/webapp/src/components/userIdentification/podLogin/Pod.tsx +++ b/webapp/src/components/userIdentification/podLogin/Pod.tsx @@ -44,8 +44,7 @@ export default function PodLogin() { const [provider, setProvider] = useState(''); const [idp, setIdp] = useState("https://inrupt.net"); - let redirectUrl = window.location.origin.concat("/home/welcome"); - console.log(redirectUrl) + let redirectToUrl = window.location.origin.concat("/home/welcome"); const providers = GetProviders(); @@ -89,8 +88,8 @@ export default function PodLogin() { {"Logo {option.name} @@ -109,7 +108,7 @@ export default function PodLogin() { {"Logo @@ -123,7 +122,7 @@ export default function PodLogin() { diff --git a/webapp/src/components/windowComponents/friends/FriendsComponent.tsx b/webapp/src/components/windowComponents/friends/FriendsComponent.tsx index 755c7ba..5855c29 100644 --- a/webapp/src/components/windowComponents/friends/FriendsComponent.tsx +++ b/webapp/src/components/windowComponents/friends/FriendsComponent.tsx @@ -128,7 +128,7 @@ export const FriendsComponent = (props: { friends: Promise, daddy: any position: [parseFloat(place.latitude), parseFloat(place.longitude)], name: place.nombre, type: "friend", - iconUrl: "../markers/friendsMarker.png", + iconUrl: "friendsMarker.png", category: place.category, imageUrl: place.images[0]?.url }) diff --git a/webapp/src/components/windowComponents/groups/GroupsComponent.tsx b/webapp/src/components/windowComponents/groups/GroupsComponent.tsx index 9376d5a..85d2e0d 100644 --- a/webapp/src/components/windowComponents/groups/GroupsComponent.tsx +++ b/webapp/src/components/windowComponents/groups/GroupsComponent.tsx @@ -119,7 +119,7 @@ export const Groups = (props: { groups: Promise, daddy: any, refresh: a position: [parseFloat(place.latitude), parseFloat(place.longitude)], name: place.nombre, type: "mine", - iconUrl: "../markers/myMarker.png", + iconUrl: "myMarker.png", category: place.category, imageUrl: place.images[0]?.url }) diff --git a/webapp/src/components/windowComponents/map/MapComponent.tsx b/webapp/src/components/windowComponents/map/MapComponent.tsx index ab04ce9..ed66f9e 100644 --- a/webapp/src/components/windowComponents/map/MapComponent.tsx +++ b/webapp/src/components/windowComponents/map/MapComponent.tsx @@ -21,7 +21,7 @@ function markerIcon(url: string): L.Icon { }; const addMarkerIcon = new L.Icon({ - iconUrl: '../markers/add-location.png', + iconUrl: 'add-location.png', iconSize: [47, 47] }); @@ -128,7 +128,7 @@ function CleanMap(props: { myGroup: string, friendGroup: string }): any { legend.onAdd = function () { let div = L.DomUtil.create('div', 'cleanMap'); - div.innerHTML += ''; + div.innerHTML += ''; return div; }; @@ -158,9 +158,9 @@ function Legend(): any { legend.onAdd = function () { let div = L.DomUtil.create('div', 'Leyenda'); div.innerHTML += '

Leyenda

'; - div.innerHTML += 'Tus lugares
'; - div.innerHTML += 'Lugares de tus amigos
'; - div.innerHTML += 'Lugar que estás añadiendo
'; + div.innerHTML += 'Tus lugares
'; + div.innerHTML += 'Lugares de tus amigos
'; + div.innerHTML += 'Lugar que estás añadiendo
'; return div; }; diff --git a/webapp/src/components/windowComponents/places/placeViews/AddPlaceForm.tsx b/webapp/src/components/windowComponents/places/placeViews/AddPlaceForm.tsx index 9994370..5c3b8a1 100644 --- a/webapp/src/components/windowComponents/places/placeViews/AddPlaceForm.tsx +++ b/webapp/src/components/windowComponents/places/placeViews/AddPlaceForm.tsx @@ -167,7 +167,7 @@ export default function AddPlaceForm(props: { refresh: any }) { position: [parseFloat(place.latitude), parseFloat(place.longitude)], name: place.nombre, type: "mine", - iconUrl: "../markers/myMarker.png", + iconUrl: "myMarker.png", category: place.category, imageUrl: place.images[0]?.url }) From 4d16ec7aabff6307dd037b6d294298a250812d0e Mon Sep 17 00:00:00 2001 From: uo282154 <113699068+uo282154@users.noreply.github.com> Date: Sat, 29 Apr 2023 22:59:21 +0200 Subject: [PATCH 8/9] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6164b2b..dea9b72 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,5 @@ After the actions process is finished, we can access the application using the I ## Miembros del equipo - Abel Busto Dopazo, UO284262 - Adrián Fernández Álvarez, UO282154 -- Juan Hermosa Casaprima, UO276839 - Guillermo Pulido Fernández, UO282716 - Paula Suárez Prieto, UO269745 From d0e1a889de32b7ed25ad7725098a3bb5291736bc Mon Sep 17 00:00:00 2001 From: uo269745 Date: Sat, 29 Apr 2023 23:01:35 +0200 Subject: [PATCH 9/9] fix port --- webapp/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/server.ts b/webapp/server.ts index 558d02e..f5b5111 100644 --- a/webapp/server.ts +++ b/webapp/server.ts @@ -3,7 +3,7 @@ import express, { Application } from 'express'; //setting the option module to commonjs var app: Application = express(); -const port: number = 443 | 3000; +const port: number = 3000; app.use(express.static("build"));