Skip to content

Commit

Permalink
hospital list all
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbernabeu committed Mar 10, 2021
1 parent f9e3600 commit c9ac200
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/main/java/rest/HospitalResource.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
package rest;

import entities.Hospital;
import io.quarkus.panache.common.Page;
import io.quarkus.panache.common.Sort;
import rest.interfaces.IHospitalResource;

import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import java.util.List;

@Path("/api/hospitais")
Expand All @@ -37,13 +33,8 @@ public Hospital get(@PathParam("id") Long id) {
@GET
@RolesAllowed("admin")
@Produces("application/json")
public List<Hospital> list(@QueryParam("sort") @DefaultValue("id") String columnName,
@QueryParam("page") @DefaultValue("0") int pageIndex,
@QueryParam("size") @DefaultValue("20") int pageSize) {

Sort sort = Sort.by(columnName);
Page page = Page.of(pageIndex, pageSize);
return hospitalResource.list(page, sort);
public List<Hospital> list() {
return Hospital.listAll();
}

@POST
Expand Down

0 comments on commit c9ac200

Please sign in to comment.