Skip to content

Commit

Permalink
rectify query for cashier-teller transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
wkigenyi authored and galovics committed Oct 31, 2024
1 parent 542cad7 commit d202145
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ public String settleCashFromCashier(@PathParam("tellerId") @Parameter(descriptio
@Path("{tellerId}/cashiers/{cashierId}/transactions")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Retrieve Cashier Transaction", description = "")
@Operation(summary = "Retrieve Cashier Transactions", description = "")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsResponse.class)))) })
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdTransactionsResponse.class))) })
public String getTransactionsForCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId,
@PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId,
@QueryParam("currencyCode") @Parameter(description = "currencyCode") final String currencyCode,
Expand Down Expand Up @@ -331,10 +331,10 @@ public String getTransactionsForCashier(@PathParam("tellerId") @Parameter(descri
@Path("{tellerId}/cashiers/{cashierId}/summaryandtransactions")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Transactions Wtih Summary For Cashier", description = "")
@Operation(summary = "Retrieve Transactions With Summary For Cashier", description = "")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = TellerApiResourceSwagger.GetTellersTellerIdCashiersCashiersIdSummaryAndTransactionsResponse.class))) })
public String getTransactionsWtihSummaryForCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId,
public String getTransactionsWithSummaryForCashier(@PathParam("tellerId") @Parameter(description = "tellerId") final Long tellerId,
@PathParam("cashierId") @Parameter(description = "cashierId") final Long cashierId,
@QueryParam("currencyCode") @Parameter(description = "currencyCode") final String currencyCode,
@QueryParam("offset") @Parameter(description = "offset") final Integer offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ public class CashierNotFoundException extends AbstractPlatformResourceNotFoundEx
public CashierNotFoundException(Long cashierId) {
super(ERROR_MESSAGE_CODE, DEFAULT_ERROR_MESSAGE, cashierId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.fineract.organisation.teller.exception;

import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
import org.springframework.dao.EmptyResultDataAccessException;

/**
* Indicates that a teller could not be found.
Expand All @@ -40,4 +41,8 @@ public class TellerNotFoundException extends AbstractPlatformResourceNotFoundExc
public TellerNotFoundException(Long tellerId) {
super(ERROR_MESSAGE_CODE, DEFAULT_ERROR_MESSAGE, tellerId);
}

public TellerNotFoundException(Long id, EmptyResultDataAccessException e) {
super("error.msg.teller.id.invalid", "Teller with identifier " + id + " does not exist", id, e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,13 @@ public Long fetchPK(GeneratedKeyHolder keyHolder) {
}
};
}

public String incrementDateByOneDay(String dateColumn) {
return switch (getDialect()) {
case POSTGRESQL -> " " + dateColumn + "+1";
case MYSQL -> " DATE_ADD(" + dateColumn + ", INTERVAL 1 DAY) ";
};

}

}
Loading

0 comments on commit d202145

Please sign in to comment.