diff --git a/pom.xml b/pom.xml index 30adabb..94c4e97 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ de.infinimotion model-backend - 0.0.110 + 0.0.116 diff --git a/src/main/java/de/infinimotion/backend/endpoint/Statistics.java b/src/main/java/de/infinimotion/backend/endpoint/Statistics.java index 7e038ea..a59dc05 100644 --- a/src/main/java/de/infinimotion/backend/endpoint/Statistics.java +++ b/src/main/java/de/infinimotion/backend/endpoint/Statistics.java @@ -6,6 +6,8 @@ import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; +import java.util.List; + @ApplicationScoped @Path("/statistics") public class Statistics { @@ -14,28 +16,21 @@ public class Statistics { RequestReply requester; @GET - @Path("/list") - public StatisticsReduced list() throws Exception { + @Path("/movies") + public List listMovies() throws Exception { CommandListStatistics request = new CommandListStatistics(); + request.setMovies(true); CommandWrapper requestWrapper = request.serialize().generateIds().commit(); - CommandListStatisticsResponse response = CommandListStatisticsResponse.deserialize(requester.request(requestWrapper)); + return CommandListStatisticsResponse.deserialize(requester.request(requestWrapper)).getMovies(); + } - StatisticsReduced stats = new StatisticsReduced(); - stats.setMovies(response.getMovies().stream().map(movieStats -> { - StatisticsFilmReduced reduced = new StatisticsFilmReduced(); - reduced.setMovie(movieStats.getMovie()); - reduced.setTickets(movieStats.getTickets().size()); - reduced.setEarnings(movieStats.getEarnings()); - return reduced; - }).toList()); - stats.setShows(response.getShows().stream().map(showStats -> { - StatisticsVorstellungReduced reduced = new StatisticsVorstellungReduced(); - reduced.setShow(showStats.getShow()); - reduced.setTickets(showStats.getTickets().size()); - reduced.setEarnings(showStats.getEarnings()); - return reduced; - }).toList()); - return stats; + @GET + @Path("/shows") + public List listShows() throws Exception { + CommandListStatistics request = new CommandListStatistics(); + request.setShows(true); + CommandWrapper requestWrapper = request.serialize().generateIds().commit(); + return CommandListStatisticsResponse.deserialize(requester.request(requestWrapper)).getShows(); } }