Skip to content

Commit

Permalink
feat: add endpoint to get ongoing campaigns by type (V1, V2 or V3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BettyB979 committed Sep 11, 2024
1 parent f8d66f2 commit 4b64d3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private CampaignOngoingDto convertToCampaignOngoingDto(Campaign campaign) {
}

private boolean isCampaignInType(Campaign c, String campaignType) {
if (campaignType.isEmpty())
if (StringUtils.isEmpty(campaignType))
return true;
if (campaignType.equalsIgnoreCase(V3.name()))
return parametersService.findSuitableParameterValue(c, Parameters.ParameterEnum.URL_TYPE).equalsIgnoreCase(campaignType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@

public class ParamValidator {

private ParamValidator() {
throw new IllegalStateException("Validation class");
}

public static void validateParams(ParamsDto paramsDto) {
if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.URL_TYPE.name())
&& Arrays.stream(UrlTypeEnum.values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) {

throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(UrlTypeEnum.values()).map(item -> item.name())
throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(UrlTypeEnum.values()).map(Enum::name)
.collect(joining(" "))));
}
if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.URL_REDIRECTION.name())
&& Arrays.stream(UrlRedirectionEnum.values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) {

throw new NotMatchException(String.format("Only %s are valid values for URL_REDIRECTION", Arrays.stream(UrlRedirectionEnum.values()).map(item -> item.name())
throw new NotMatchException(String.format("Only %s are valid values for URL_REDIRECTION", Arrays.stream(UrlRedirectionEnum.values()).map(Enum::name)
.collect(joining(" "))));
}
if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.MAIL_ASSISTANCE.name())
Expand Down

0 comments on commit 4b64d3d

Please sign in to comment.