Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

feat: opening hours as array #225

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package app.coronawarn.quicktest.model.keycloak;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import lombok.Data;
Expand Down Expand Up @@ -50,8 +51,8 @@ public class KeycloakGroupDetails {

private String email;

@Size(max = 50)
private String openingHours;
@Size(max = 7)
private List<@Size(max = 64) String> openingHours;

private Boolean appointmentRequired;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import app.coronawarn.quicktest.model.keycloak.KeycloakUserResponse;
import app.coronawarn.quicktest.model.map.MapEntrySingleResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -249,7 +250,7 @@ public KeycloakGroupDetails getSubGroupDetails(String groupId) {
mapEntry.getAppointment()));
if (mapEntry.getOpeningHours() != null) {
groupDetails.setOpeningHours(
mapEntry.getOpeningHours().length > 0 ? mapEntry.getOpeningHours()[0] : null);
mapEntry.getOpeningHours().length > 0 ? Arrays.asList(mapEntry.getOpeningHours()) : null);
}
} else {
groupDetails.setSearchPortalConsent(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.keycloak.admin.client.Keycloak;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -124,8 +125,9 @@ private MapEntryUploadData buildUploadData(KeycloakGroupDetails details) {
mapEntryUploadData.setEmail(details.getEmail());
mapEntryUploadData.setAppointment(convertAppointmentToString(details.getAppointmentRequired()));
mapEntryUploadData.setWebsite(details.getWebsite());
String[] openingHours = {details.getOpeningHours()};
mapEntryUploadData.setOpeningHours(openingHours);
if (CollectionUtils.isNotEmpty(details.getOpeningHours())) {
mapEntryUploadData.setOpeningHours(details.getOpeningHours().toArray(String[]::new));
}

return mapEntryUploadData;
}
Expand Down