Skip to content

Commit

Permalink
CIRCSTORE-513 print-events-storage.raml modified
Browse files Browse the repository at this point in the history
  • Loading branch information
SreejaMangarapu committed Jul 7, 2024
1 parent 7d0d782 commit 445b474
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
"methods": [
"POST"
],
"pathPattern": "/print-events-storage/print-events",
"pathPattern": "/print-events-storage/print-events/create-batch",
"permissionsRequired": [
"circulation-storage.print-events.post"
]
Expand Down
6 changes: 3 additions & 3 deletions ramls/print-events-storage.raml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ types:
traits:
validate: !include raml-util/traits/validation.raml

/print-events-storage:
/print-events:
post:
/print-events-storage/print-events:
/create-batch:
post:
is: [validate]
description: save a print event log
body:
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/org/folio/rest/impl/PrintEventsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.vertx.core.Context;
import io.vertx.core.Handler;
import org.folio.rest.jaxrs.model.PrintEventsRequest;
import org.folio.rest.jaxrs.resource.PrintEventsStorage;
import org.folio.rest.jaxrs.resource.PrintEventsStoragePrintEvents;
import org.folio.service.PrintEventsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -14,15 +14,16 @@

import static io.vertx.core.Future.succeededFuture;

public class PrintEventsApi implements PrintEventsStorage {
public class PrintEventsApi implements PrintEventsStoragePrintEvents {
private static final Logger LOG = LoggerFactory.getLogger(PrintEventsApi.class);

@Override
public void postPrintEventsStoragePrintEvents(PrintEventsRequest printEventsRequest, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
public void postPrintEventsStoragePrintEventsCreateBatch(PrintEventsRequest printEventsRequest, Map<String, String> okapiHeaders, Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
LOG.info("postPrintEventsStoragePrintEvents:: save print events {}", printEventsRequest);
new PrintEventsService(vertxContext, okapiHeaders)
.create(printEventsRequest)
.onSuccess(response -> asyncResultHandler.handle(succeededFuture(response)))
.onFailure(throwable -> asyncResultHandler.handle(succeededFuture(PostPrintEventsStoragePrintEventsResponse.respond500WithTextPlain(throwable))));
.onFailure(throwable -> asyncResultHandler.handle(succeededFuture(PostPrintEventsStoragePrintEventsCreateBatchResponse.respond500WithTextPlain(throwable.getMessage()))));

}
}
4 changes: 2 additions & 2 deletions src/main/java/org/folio/service/PrintEventsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io.vertx.core.Future;
import org.folio.rest.model.PrintEvent;
import org.folio.rest.jaxrs.model.PrintEventsRequest;
import org.folio.rest.jaxrs.resource.PrintEventsStorage;
import org.folio.rest.jaxrs.resource.PrintEventsStoragePrintEvents;
import org.folio.rest.persist.PgUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -39,6 +39,6 @@ public Future<Response> create(PrintEventsRequest printEventRequest) {
return event;
}).toList();
return PgUtil.postSync(PRINT_EVENTS_TABLE, printEvents, MAX_ENTITIES, false, okapiHeaders, vertxContext,
PrintEventsStorage.PostPrintEventsStoragePrintEventsResponse.class);
PrintEventsStoragePrintEvents.PostPrintEventsStoragePrintEventsCreateBatchResponse.class);
}
}

0 comments on commit 445b474

Please sign in to comment.