diff --git a/descriptors/ModuleDescriptor-template.json b/descriptors/ModuleDescriptor-template.json index 5390b2da..1e232647 100644 --- a/descriptors/ModuleDescriptor-template.json +++ b/descriptors/ModuleDescriptor-template.json @@ -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" ] diff --git a/ramls/print-events-storage.raml b/ramls/print-events-storage.raml index 7dbf272c..ea6ae2a8 100644 --- a/ramls/print-events-storage.raml +++ b/ramls/print-events-storage.raml @@ -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: diff --git a/src/main/java/org/folio/rest/impl/PrintEventsApi.java b/src/main/java/org/folio/rest/impl/PrintEventsApi.java index dd8747ba..34317dad 100644 --- a/src/main/java/org/folio/rest/impl/PrintEventsApi.java +++ b/src/main/java/org/folio/rest/impl/PrintEventsApi.java @@ -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; @@ -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 okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { + public void postPrintEventsStoragePrintEventsCreateBatch(PrintEventsRequest printEventsRequest, Map okapiHeaders, Handler> 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())))); + } } diff --git a/src/main/java/org/folio/service/PrintEventsService.java b/src/main/java/org/folio/service/PrintEventsService.java index 86cae536..12a443e2 100644 --- a/src/main/java/org/folio/service/PrintEventsService.java +++ b/src/main/java/org/folio/service/PrintEventsService.java @@ -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; @@ -39,6 +39,6 @@ public Future create(PrintEventsRequest printEventRequest) { return event; }).toList(); return PgUtil.postSync(PRINT_EVENTS_TABLE, printEvents, MAX_ENTITIES, false, okapiHeaders, vertxContext, - PrintEventsStorage.PostPrintEventsStoragePrintEventsResponse.class); + PrintEventsStoragePrintEvents.PostPrintEventsStoragePrintEventsCreateBatchResponse.class); } }