Skip to content

Commit

Permalink
[MODINVOSTO-187] Handle invoice line creation FK issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Saba-Zedginidze-EPAM committed Nov 6, 2024
1 parent 21581e3 commit a02a551
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;

import static org.folio.rest.impl.InvoiceStorageImpl.INVOICE_LINE_TABLE;
import static org.folio.rest.utils.ResponseUtils.convertPgExceptionIfNeeded;

public class InvoiceLinesPostgresDAO implements InvoiceLinesDAO {
private final Logger log = LogManager.getLogger();
Expand All @@ -29,6 +30,7 @@ public Future<List<InvoiceLine>> getInvoiceLines(Criterion criterion, Conn conn)
public Future<String> createInvoiceLine(InvoiceLine invoiceLine, Conn conn) {
log.trace("createInvoiceLine:: Creating invoice line: {}", invoiceLine);
return conn.save(INVOICE_LINE_TABLE, invoiceLine)
.recover(t -> Future.failedFuture(convertPgExceptionIfNeeded(t)))
.onSuccess(invoiceLineId -> log.info("createInvoiceLine:: Created invoice line with id: {}", invoiceLineId))
.onFailure(t -> log.error("Failed to create invoice line: {}", invoiceLine, t));
}
Expand Down

0 comments on commit a02a551

Please sign in to comment.