-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Book resource customization + add additional findByPublicationYear me…
…thod
- Loading branch information
1 parent
a3621ff
commit 664ff90
Showing
2 changed files
with
26 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.acme; | ||
|
||
import io.quarkus.hibernate.orm.rest.data.panache.PanacheEntityResource; | ||
import io.quarkus.rest.data.panache.MethodProperties; | ||
import io.quarkus.rest.data.panache.ResourceProperties; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.PathParam; | ||
import jakarta.ws.rs.Produces; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@ResourceProperties(path = "books") | ||
public interface BookRepository extends PanacheEntityResource<Book, Long> { | ||
|
||
@MethodProperties(exposed = false) | ||
boolean delete(Long id); | ||
|
||
@GET | ||
@Path("/year/{year}") | ||
@Produces("application/json") | ||
default List<Book> findByPublicationYear(@PathParam("year") Integer year) { | ||
return Book.find("publicationYear = :year", Collections.singletonMap("year", year)).list(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.