Skip to content

Commit

Permalink
updaet api
Browse files Browse the repository at this point in the history
Signed-off-by: Nicklas Körtge <[email protected]>
  • Loading branch information
n1ckl0sk0rtge committed Nov 14, 2024
1 parent deef399 commit d40656d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SCAN": "v1/scan",
"LAST_CBOMS": "api/v1/cbom/lastn",
"LAST_CBOMS": "api/v1/cbom/last",
"CHECK_POLICY": "api/v1/compliance/check"
}
2 changes: 1 addition & 1 deletion frontend/src/helpers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { checkValidComplianceResults, createLocalComplianceReport, isViewerOnly


export function fetchLastCboms(number) {
let apiUrl = `${API_LAST_CBOM_URL}?limit=${number}`;
let apiUrl = `${API_LAST_CBOM_URL}/${number}`;
fetchDataFromApi(apiUrl, null)
.then((jsonData) => {
model.lastCboms = jsonData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import jakarta.ws.rs.core.Response;
import java.util.concurrent.ExecutionException;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.jboss.resteasy.reactive.RestQuery;
import org.jboss.resteasy.reactive.RestPath;

@Path("/api/v1/cbom")
@ApplicationScoped
Expand All @@ -45,15 +45,15 @@ public CBOMResource(@Nonnull IQueryBus queryBus) {
}

@GET
@Path("/lastn")
@Path("/last/{limit}")
@Produces(MediaType.APPLICATION_JSON)
@Operation(
summary = "Return recently generated CBOMs from the repository",
description =
"Returns a list of the most recently generated CBOMs. "
+ "The length of the list can by specified via the optional 'limit' "
+ "parameter.")
public Response getLastCBOMs(@RestQuery @Nullable Integer limit)
public Response getLastCBOMs(@RestPath @Nullable Integer limit)
throws ExecutionException, InterruptedException {
return this.queryBus
.send(new ListStoredCBOMsQuery(limit))
Expand All @@ -62,15 +62,15 @@ public Response getLastCBOMs(@RestQuery @Nullable Integer limit)
}

@GET
@Path("/byIdentifier")
@Path("/{projectIdentifier}")
@Produces(MediaType.APPLICATION_JSON)
public Response getCBOM(@RestQuery @Nullable String identifier)
public Response getCBOM(@RestPath @Nullable String projectIdentifier)
throws ExecutionException, InterruptedException {
if (identifier == null) {
if (projectIdentifier == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
return this.queryBus
.send(new GetCBOMByProjectIdentifierQuery(identifier))
.send(new GetCBOMByProjectIdentifierQuery(projectIdentifier))
.thenApply(readModel -> Response.ok(readModel).build())
.get();
}
Expand Down

0 comments on commit d40656d

Please sign in to comment.