diff --git a/backend/sportsmatch/src/main/java/com/sportsmatch/auth/SecurityConfig.java b/backend/sportsmatch/src/main/java/com/sportsmatch/auth/SecurityConfig.java index bd0de124..570b9883 100644 --- a/backend/sportsmatch/src/main/java/com/sportsmatch/auth/SecurityConfig.java +++ b/backend/sportsmatch/src/main/java/com/sportsmatch/auth/SecurityConfig.java @@ -26,8 +26,17 @@ public class SecurityConfig { @Value("${app.sportsmingle.frontend.url}") private String frontendUrl; + private static final String[] WHITE_LIST_URL = { - "/api/v1/auth/**", "/h2-console/**", "/v3/api-docs", "/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html", "/api/v1/places/search", "/api/v1/event/nearby" + "/api/v1/auth/**", + "/h2-console/**", + "/v3/api-docs", + "/v3/api-docs/**", + "/swagger-ui/**", + "/swagger-ui.html", + "/api/v1/places/search", + "/api/v1/event/nearby", + "/api/v1/sports/all" }; private final JwtAuthFilter jwtAuthFilter; private final AuthenticationProvider authenticationProvider; diff --git a/backend/sportsmatch/src/main/java/com/sportsmatch/controllers/EventsController.java b/backend/sportsmatch/src/main/java/com/sportsmatch/controllers/EventsController.java index 615f902c..2bc8aeca 100644 --- a/backend/sportsmatch/src/main/java/com/sportsmatch/controllers/EventsController.java +++ b/backend/sportsmatch/src/main/java/com/sportsmatch/controllers/EventsController.java @@ -62,17 +62,18 @@ public List getEventsHistory(@ParameterObject final Pageable pa return eventService.getEventsHistory(pageable); } - /** - * This endpoint returns list of Events sorted by distance from the given location. User can filter by sports. + * This endpoint returns list of Events sorted by distance from the given location. User can + * filter by sports. * - * @param requestEventDTO it contains longitude and latitude and a list of sports for filter if given - * @param pageable it contains the page and size for pagination + * @param requestEventDTO it contains longitude and latitude and a list of sports for filter if + * given + * @param pageable it contains the page and size for pagination * @return a list of Events sorted by distance from the given location. User can filter by sports. */ @GetMapping("/nearby") - public List getNearbyEvents(@RequestBody RequestEventDTO requestEventDTO, - @ParameterObject final Pageable pageable) { + public List getNearbyEvents( + @ParameterObject RequestEventDTO requestEventDTO, @ParameterObject final Pageable pageable) { return eventService.getNearbyEvents(requestEventDTO, pageable); } diff --git a/backend/sportsmatch/src/main/java/com/sportsmatch/models/Event.java b/backend/sportsmatch/src/main/java/com/sportsmatch/models/Event.java index c6f6ef4a..a36e6577 100644 --- a/backend/sportsmatch/src/main/java/com/sportsmatch/models/Event.java +++ b/backend/sportsmatch/src/main/java/com/sportsmatch/models/Event.java @@ -16,9 +16,7 @@ @AllArgsConstructor public class Event { - @Id - @GeneratedValue - private Long id; + @Id @GeneratedValue private Long id; @Column(name = "date_start") private LocalDateTime dateStart; @@ -34,6 +32,7 @@ public class Event { private String title; + @Column(name = "is_rank_updated") private Boolean isRanksUpdated = false; @OneToMany(cascade = CascadeType.ALL, mappedBy = "event") @@ -42,8 +41,7 @@ public class Event { @OneToMany(cascade = CascadeType.ALL, mappedBy = "event") private Set ratings = new HashSet<>(); - @ManyToOne - private Sport sport; + @ManyToOne private Sport sport; @ManyToOne @JoinColumn(name = "place_id") diff --git a/backend/sportsmatch/src/main/java/com/sportsmatch/repositories/EventRepository.java b/backend/sportsmatch/src/main/java/com/sportsmatch/repositories/EventRepository.java index 857477ff..d933af22 100644 --- a/backend/sportsmatch/src/main/java/com/sportsmatch/repositories/EventRepository.java +++ b/backend/sportsmatch/src/main/java/com/sportsmatch/repositories/EventRepository.java @@ -51,7 +51,7 @@ List findEventsByUser( * @return list of events filtered by sport names if given, and order by distance from the user's given location */ @Query(nativeQuery = true, value = - "SELECT e.id, e.date_start, e.date_end, e.min_elo, e.max_elo, e.title, e.sport_id, e.place_id " + "SELECT e.id, e.date_start, e.date_end, e.min_elo, e.max_elo, e.title, e.is_rank_updated, e.sport_id, e.place_id " + "FROM events e " + "JOIN sports s ON e.sport_id = s.id " + "JOIN places p ON e.place_id = p.id " diff --git a/frontend/sportsmatch-app/src/components/SportsButtonComponent.tsx b/frontend/sportsmatch-app/src/components/SportsButtonComponent.tsx index 6c4120c4..b97e8a48 100644 --- a/frontend/sportsmatch-app/src/components/SportsButtonComponent.tsx +++ b/frontend/sportsmatch-app/src/components/SportsButtonComponent.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import '../styles/NewUserComponent.css' import { useNavigate } from 'react-router-dom' +import { SportControllerService, SportDTO } from '../generated/api' function SportsButtonComponent({ onSportSelectionChange, @@ -40,82 +41,30 @@ function SportsButtonComponent({ navigate('/allsports', { state: { selectedButtonSports } }) } + const [sports, setSports] = useState([]) + + useEffect(() => { + const fetchSports = async () => { + setSports((await SportControllerService.getSports(0, 5)) as SportDTO[]) + } + fetchSports() + }, []) + return (

Select your sports

- - - - - - - - + {sports.map((s, index) => ( + + ))}
+ {filteredEvent.length > 0 && ( +
+
+ +
+
+ )} ) diff --git a/frontend/sportsmatch-app/src/styles/JoinEvent.css b/frontend/sportsmatch-app/src/styles/JoinEvent.css index d4723337..4102bd7d 100644 --- a/frontend/sportsmatch-app/src/styles/JoinEvent.css +++ b/frontend/sportsmatch-app/src/styles/JoinEvent.css @@ -9,7 +9,10 @@ } -.join-event-wrapper { +.join-event-wrapper { + display: flex; + flex-direction: column; + justify-content: space-around; padding-left: 5%; padding-right: 5%; color: var(--sm-orange); diff --git a/frontend/sportsmatch-app/src/styles/Modal.css b/frontend/sportsmatch-app/src/styles/Modal.css index 2f144a67..48ddd2d7 100644 --- a/frontend/sportsmatch-app/src/styles/Modal.css +++ b/frontend/sportsmatch-app/src/styles/Modal.css @@ -1,6 +1,6 @@ .modal-overlay { z-index: 9999; - position: absolute; + position: fixed; top: 0; left: 0; width: 100vw; @@ -12,7 +12,9 @@ } .modal-box { - display: block; + display: flex; + align-items: center; + justify-content: center; background: transparent; width: 90%; height: 75%;