Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump openapi-generator-maven-plugin to v7.7.0 #151

Merged
merged 1 commit into from
Jul 17, 2024
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
16 changes: 15 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>6.6.0</version>
<version>7.7.0</version>
<executions>
<execution>
<id>data-api</id>
Expand Down Expand Up @@ -360,6 +360,19 @@
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>

<typeMappings>
<typeMapping>string+date-time=Instant</typeMapping>
<typeMapping>string+time=LocalTime</typeMapping>
</typeMappings>
<schemaMappings>
<schemaMapping>Instant=java.time.Instant</schemaMapping>
<schemaMapping>LocalTime=java.time.LocalTime</schemaMapping>
</schemaMappings>
<importMappings>
<importMapping>Instant=java.time.Instant</importMapping>
<importMapping>LocalTime=java.time.LocalTime</importMapping>
</importMappings>

<configOptions>
<useSpringBoot3>true</useSpringBoot3>
<sourceFolder>src</sourceFolder>
Expand All @@ -368,6 +381,7 @@
<useTags>true</useTags>
<openApiNullable>false</openApiNullable>
<skipDefaultInterface>true</skipDefaultInterface>
<requestMappingMode>api_interface</requestMappingMode>
</configOptions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ResponseEntity<Void> storeExternalBulk(String moreApiToken, EndpointDataB
Interval interval = externalService.getIntervalForObservation(apiRoutingInfo.studyId(), apiRoutingInfo.observationId(), participantId);

endpointDataBulkDTO.getDataPoints().stream()
.map(datapoint -> datapoint.getTimestamp().toInstant())
.map(ExternalDataDTO::getTimestamp)
.map(timestamp -> timestamp.isBefore(interval.getStart()) || timestamp.isAfter(interval.getEnd()))
.filter(v -> v)
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
package io.redlink.more.data.controller.transformer;

import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

public final class BaseTransformers {

Expand All @@ -16,14 +14,4 @@ public static Long toVersionTag(Instant modified) {
return modified.toEpochMilli();
}

public static Instant toInstant(OffsetDateTime dateTime) {
if (dateTime == null)
return null;
return dateTime.toInstant();
}

public static OffsetDateTime toOffsetDateTime(Instant instant) {
if (instant == null) return null;
return instant.atOffset(ZoneOffset.UTC);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ public static List<DataPoint> createDataPoints(DataBulkDTO bulk) {
}

public static DataPoint createDataPoint(ObservationDataDTO dataPoint, Instant recordingTime) {
Instant dateTime = dataPoint.getTimestamp();
return new DataPoint(
dataPoint.getDataId(),
dataPoint.getObservationId(),
dataPoint.getObservationType(),
dataPoint.getObservationType(),
recordingTime,
BaseTransformers.toInstant(dataPoint.getTimestamp()),
dateTime,
dataPoint.getDataValue());
}

Expand All @@ -44,13 +45,14 @@ public static List<DataPoint> createDataPoints(EndpointDataBulkDTO bulk, ApiRout
}

public static DataPoint createDataPoint(ExternalDataDTO dataPoint, ApiRoutingInfo routingInfo, Instant recordingTime, Integer observationId) {
Instant dateTime = dataPoint.getTimestamp();
return new DataPoint(
UUID.randomUUID().toString(),
observationId.toString(),
routingInfo.observationType(),
routingInfo.observationType(),
recordingTime,
BaseTransformers.toInstant(dataPoint.getTimestamp()),
dateTime,
dataPoint.getDataValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static ParticipantDTO toDTO(Participant participant) {
participant.alias(),
ParticipantStatusDTO.fromValue(participant.status()),
toGroupDto(participant),
BaseTransformers.toOffsetDateTime(participant.start())
participant.start()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ public static ObservationDTO toDTO(Observation observation, Instant start, Insta
}

public static ObservationScheduleDTO toObservationScheduleDTO(Range<Instant> schedule) {
Instant instant = schedule.getMaximum();
Instant instant1 = schedule.getMinimum();
return new ObservationScheduleDTO()
.start(BaseTransformers.toOffsetDateTime(schedule.getMinimum()))
.end(BaseTransformers.toOffsetDateTime(schedule.getMaximum()))
.start(instant1)
.end(instant)
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.redlink.more.data.api.app.v1.model.PushNotificationDTO;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Component;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.*;

@Component
public class NotificationRepository {

Expand Down Expand Up @@ -68,10 +69,10 @@ private static RowMapper<PushNotificationDTO> getRowMapper() {
};
}

private static OffsetDateTime getTimestamp(ResultSet rs) {
private static Instant getTimestamp(ResultSet rs) {
try {
return Optional.ofNullable(rs.getTimestamp("timestamp"))
.map(d -> d.toInstant().atOffset(ZoneOffset.UTC))
.map(Timestamp::toInstant)
.orElse(null);
} catch (SQLException e) {
return null;
Expand Down
Loading