== Implementation of user scenarios in the prototype In the technical prototype of the application implemented so far, the following scenarios have been implemented: ||= ID =||||= !UseCase =|| ||1||||'''[wiki:SearchRoutesUseCase Search Routes]'''|| ||2||||'''[wiki:OrganizeTripUseCase Organize Trip]'''|| ||3||||'''[wiki:ManageTripUseCase Manage Trip]'''|| ||4||||'''[wiki:ViewMyTripsUseCase View My Trips]'''|| ||5||||'''[wiki:LoginUseCase Login]'''|| ||6||||'''[wiki:RegisterUseCase Register]'''|| === **ID 1** - Search Routes The `/search-routes` endpoint provides users with the ability to search for available transport routes from different organizers. It supports both **viewing all routes** by default and **filtering routes** based on user input (departure and arrival locations). The request is handled by `UserRouteController`, which interacts with `RouteService` to retrieve the relevant data. Here is an example of a search query: -`/search-routes?from=sk&to=ohrid` === {{{ @RequestMapping("/search-routes") public class UserRouteController { private final RouteService routeService; public UserRouteController(RouteService routeService) { this.routeService = routeService; } @GetMapping public String findRoutesByFromAndTo(@RequestParam(required = false) String from, @RequestParam(required = false) String to, Model model) { List filteredRoutes = ((from == null || from.isBlank()) && (to == null || to.isBlank())) ? routeService.findAll() : routeService.findRouteByFromAndToDest(from, to); model.addAttribute(filteredRoutes.isEmpty() ? "noRoutesMessage" : "routes", filteredRoutes.isEmpty() ? "No routes found for your search." : filteredRoutes); model.addAttribute("display", "user/search-routes"); return "master"; } } }}} === ==== Controller Details: - **URL Mapping:** `/search-routes` - **Method:** `GET` - **Functionality:** - Displays **all routes** when the page is accessed without search criteria. - Filters results based on the user's input (`from` and `to`). - **View:** Uses the `master` template and dynamically embeds `user/search-routes`. ==== Breakdown: - When users first visit `/search-routes`, the controller calls `routeService.findAll()` to display all available routes. - When users provide search criteria (`from` and/or `to`), it filters results using `routeService.findRouteByFromAndToDest(from, to)`. - If no matching routes are found, a **"No routes found for your search."** message is displayed instead of an empty table. - The retrieved data is added to the `Model`, ensuring the front-end can render the appropriate content. === ==== Result of `/search-routes` [[Image(search-routes.png, 100%)]] === ==== Result of `/search-routes?from=sk&to=ohrid` [[Image(search-routes-filter.png, 100%)]] ===