-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- CHG: Adjusted collaborators endpoints to include projects information.
-
- Loading branch information
1 parent
b85a8c9
commit 559bd73
Showing
10 changed files
with
118 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
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
53 changes: 53 additions & 0 deletions
53
src/main/java/jhi/germinate/server/resource/collaborator/CollaboratorTableResource.java
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,53 @@ | ||
package jhi.germinate.server.resource.collaborator; | ||
|
||
import jakarta.annotation.security.PermitAll; | ||
import jakarta.ws.rs.*; | ||
import jakarta.ws.rs.core.*; | ||
import jhi.gatekeeper.resource.PaginatedResult; | ||
import jhi.germinate.resource.PaginatedRequest; | ||
import jhi.germinate.server.Database; | ||
import jhi.germinate.server.database.codegen.tables.pojos.ViewTableCollaborators; | ||
import jhi.germinate.server.resource.BaseResource; | ||
import jhi.germinate.server.util.Secured; | ||
import org.jooq.*; | ||
|
||
import java.sql.*; | ||
import java.util.List; | ||
|
||
import static jhi.germinate.server.database.codegen.tables.ViewTableCollaborators.VIEW_TABLE_COLLABORATORS; | ||
|
||
@Path("collaborator/table") | ||
@Secured | ||
@PermitAll | ||
public class CollaboratorTableResource extends BaseResource | ||
{ | ||
@POST | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public Response postCollaboratorTable(PaginatedRequest request) | ||
throws SQLException | ||
{ | ||
processRequest(request); | ||
try (Connection conn = Database.getConnection()) | ||
{ | ||
DSLContext context = Database.getContext(conn); | ||
SelectSelectStep<Record> select = context.select(); | ||
|
||
if (previousCount == -1) | ||
select.hint("SQL_CALC_FOUND_ROWS"); | ||
|
||
SelectJoinStep<Record> from = select.from(VIEW_TABLE_COLLABORATORS); | ||
|
||
// Filter here! | ||
where(from, filters, true); | ||
|
||
List<ViewTableCollaborators> result = setPaginationAndOrderBy(from) | ||
.fetch() | ||
.into(ViewTableCollaborators.class); | ||
|
||
long count = previousCount == -1 ? context.fetchOne("SELECT FOUND_ROWS()").into(Long.class) : previousCount; | ||
|
||
return Response.ok(new PaginatedResult<>(result, count)).build(); | ||
} | ||
} | ||
} |
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
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
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
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
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