|
22 | 22 | import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; |
23 | 23 | import org.eclipse.microprofile.openapi.annotations.tags.Tag; |
24 | 24 |
|
| 25 | +import fr.fxjavadevblog.aid.api.exceptions.ResourceNotFoundException; |
25 | 26 | import fr.fxjavadevblog.aid.api.videogame.VideoGame; |
26 | 27 | import fr.fxjavadevblog.aid.api.videogame.VideoGameRepository; |
27 | 28 | import fr.fxjavadevblog.aid.metadata.ApplicationConfig; |
|
30 | 31 | import fr.fxjavadevblog.aid.utils.jaxrs.pagination.QueryParameterUtils; |
31 | 32 | import fr.fxjavadevblog.aid.utils.pagination.PagedResponse; |
32 | 33 | import fr.fxjavadevblog.aid.utils.validation.SortableOn; |
| 34 | +import fr.fxjavadevblog.preconditions.Checker; |
33 | 35 | import io.quarkus.hibernate.orm.panache.PanacheQuery; |
34 | 36 | import io.quarkus.panache.common.Sort; |
35 | 37 | import lombok.extern.slf4j.Slf4j; |
@@ -57,6 +59,19 @@ public class GenreResource |
57 | 59 | public Genre[] getAllGenres() { |
58 | 60 | return Genre.values(); |
59 | 61 | } |
| 62 | + |
| 63 | + @GET |
| 64 | + @Path("/{genre}") |
| 65 | + @Operation(summary = "Return a video game Genre") |
| 66 | + @APIResponse(responseCode = "200", description = "OK") |
| 67 | + @APIResponse(responseCode = "404", description = "The genre does not exist.", ref = ApplicationConfig.RESPONSE_API_ERROR) |
| 68 | + public Response getGenre(@PathParam("genre") final Genre genre) |
| 69 | + { |
| 70 | + Checker.notNull("Genre", genre, ResourceNotFoundException::new); |
| 71 | + return Response.ok(genre).build(); |
| 72 | + } |
| 73 | + |
| 74 | + |
60 | 75 |
|
61 | 76 | @GET |
62 | 77 | @Operation(summary = "Get games within a genre", description = "Get all video games of the given genre") |
|
0 commit comments