Skip to content

Commit

Permalink
Organization to product lookup endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
GregJohnStewart committed Aug 15, 2022
1 parent a007c1c commit 62c39e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ebp.openQuarterMaster.baseStation.interfaces.endpoints;
package com.ebp.openQuarterMaster.baseStation.interfaces.endpoints.itemLookup;

import com.ebp.openQuarterMaster.baseStation.interfaces.endpoints.EndpointProvider;
import com.ebp.openQuarterMaster.baseStation.service.productLookup.ProductLookupService;
import com.ebp.openQuarterMaster.lib.core.rest.productLookup.ProductLookupProviderInfo;
import com.ebp.openQuarterMaster.lib.core.rest.productLookup.ProductLookupResult;
Expand Down Expand Up @@ -32,10 +33,10 @@

@Traced
@Slf4j
@Path("/api/productLookup")
@Tags({@Tag(name = "Product Lookup", description = "Endpoints for searching for products.")})
@Path("/api/externalItemLookup")
@Tags({@Tag(name = "External Item Lookup", description = "Endpoints for searching for items from other places.")})
@RequestScoped
public class ProductLookup extends EndpointProvider {
public class ItemLookup extends EndpointProvider {

@Inject
JsonWebToken jwt;
Expand All @@ -44,7 +45,7 @@ public class ProductLookup extends EndpointProvider {
ProductLookupService productLookupService;

@GET
@Path("providers")
@Path("/product/providers")
@Operation(
summary = "Gets information on supported product search providers."
)
Expand All @@ -66,11 +67,11 @@ public Response providerInfo(
) {
logRequestContext(this.jwt, securityContext);

return Response.ok(this.productLookupService.getProviderInfo()).build();
return Response.ok(this.productLookupService.getProductProviderInfo()).build();
}

@GET
@Path("providers/enabled")
@Path("/product/providers/enabled")
@Operation(
summary = "Gets information on supported and enabled product search providers."
)
Expand All @@ -93,12 +94,12 @@ public Response enabledProviderInfo(
logRequestContext(this.jwt, securityContext);

return Response.ok(
this.productLookupService.getProviderInfo().stream().filter(ProductLookupProviderInfo::isEnabled)
this.productLookupService.getProductProviderInfo().stream().filter(ProductLookupProviderInfo::isEnabled)
).build();
}

@GET
@Path("barcode/{barcode}")
@Path("product/barcode/{barcode}")
@Operation(
summary = "Searches enabled providers for the barcode given."
)
Expand All @@ -124,7 +125,7 @@ public Response searchBarcode(
}

@GET
@Path("webpage/{webpage}")
@Path("product/webpage/{webpage}")
@Operation(
summary = "Scans the given webpage for product details."
)
Expand All @@ -151,7 +152,7 @@ public Response scanWebpage(


@GET
@Path("lego/{partNo}")
@Path("lego/part/{partNo}")
@Operation(
summary = "Searches enabled providers for the barcode given."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public ProductLookupResult scanPage(URL page) throws ExecutionException, Interru
return this.pageProductSearchService.scanWebpage(page).get();
}

public List<ProductLookupProviderInfo> getProviderInfo() {
public List<ProductLookupProviderInfo> getProductProviderInfo() {
List<ProductLookupProviderInfo> output = new ArrayList<>(this.productSearchServices.size());

for (ApiProductSearchService curService : this.productSearchServices) {
Expand Down

0 comments on commit 62c39e5

Please sign in to comment.