Skip to content

Commit

Permalink
Reducción de informacion en los Placemark de la BD #156
Browse files Browse the repository at this point in the history
  • Loading branch information
aliciafp15 committed Apr 5, 2023
1 parent e3ec8d1 commit 918ccfd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
12 changes: 0 additions & 12 deletions restapi/models/model.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
const mongoose = require('mongoose');
//CAMBIAR EL NOMBRE DE LA CLASE A PLACEMARK
const dataSchema = new mongoose.Schema({
name: {
required: true,
type: String
},
description: {
required: false,
type: String
},
latitude: {
required:true,
type: Number
Expand All @@ -17,10 +9,6 @@ const dataSchema = new mongoose.Schema({
required:true,
type: Number
},
category: {
required: true,
type: String
},
webId: {
required: true,
type: String
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function App() {
useEffect(() => {
const refreshMyPlacesList = async () => {
//Con una webId como esta "https://aliciafp15.inrupt.net/profile/card#me";
if(userWebId == null)
return null;
const parts = userWebId.split('.'); // Dividimos la cadena en partes utilizando el punto como separador
//const webId = parts[0].split('//')[1]; // Obtenemos la segunda parte después de '//'
//setPlaces(await getPlaceMarksByUser(webId));
Expand Down
3 changes: 1 addition & 2 deletions webapp/src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ export async function addPlaceMark(placeMark){
method: 'POST',
headers: {'Content-Type':'application/json'},

body: JSON.stringify({name:placeMark.name, description:placeMark.description,
body: JSON.stringify({
latitude:placeMark.latitude, longitude:placeMark.longitude,
category:placeMark.category,
webId:placeMark.webId, placeID:placeMark.placeID
})

Expand Down
7 changes: 3 additions & 4 deletions webapp/src/components/AddPlaceSidebar/AddPlaceSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ function AddPlaceSidebar (props) {
place.webId = webId;//acotamos para guardar solo el nombre de usuario
console.log( webId);

//GUARDA EL LUGAR EN LOS PODS!!
//guarda el Place en los pods con todos los datos
savePlace(session,place);


//result = await addPlaceMark({name, description,latitude,longitude, category});//metodo importado, le damos los parametros necesarios
const result = await addPlaceMark(place);//metodo importado, le damos los parametros necesarios
//guarda en la base de datos la Placemark con los datos mínimos
const result = await addPlaceMark(place);//lat, long, webid, placeid
setPlaces([...places, place]);

if(result){
Expand Down
7 changes: 5 additions & 2 deletions webapp/src/components/MyPlacesSidebar/MyPlacesSidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from 'react';
import {Typography} from "@mui/material";
import useStyles from "./styles";
import PlaceCard from "../PlaceCard/PlaceCard"
import PlaceCard from "../PlaceCard/PlaceCard";
import {Marker, Popup} from "react-leaflet";
import List from '@mui/material/List';
const MyPlacesSidebar = (props) => {
const {places, setPlaces,setSelectedPlaceMyPlaces, deletePlace} = props;
const classes = useStyles();


const showPlaces = () => {

return props.places.map((place)=> (
Expand Down

0 comments on commit 918ccfd

Please sign in to comment.