Skip to content
Snippets Groups Projects
Commit cba90e36 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5093 adjust mapping grpc to timestamp

parent 94455b5b
No related branches found
No related tags found
No related merge requests found
package de.ozgcloud.apilib.common.command.grpc;
import java.time.ZonedDateTime;
import org.apache.commons.lang3.StringUtils;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
......@@ -48,8 +51,14 @@ public interface CommandMapper {
@Mapping(target = "relationVersion", ignore = true)
@Mapping(target = "relationId", qualifiedByName = "mapRelationId")
@Mapping(target = "body", ignore = true)
@Mapping(target = "createdAt", expression = "java(mapToZonedDateTime(command.getCreatedAt()))")
@Mapping(target = "finishedAt", expression = "java(mapToZonedDateTime(command.getFinishedAt()))")
OzgCloudCommand fromGrpc(GrpcCommand command);
default ZonedDateTime mapToZonedDateTime(String value) {
return StringUtils.isEmpty(value) ? null : ZonedDateTime.parse(value);
}
@Named("mapRelationId")
default StringBasedValue mapRelationId(String relationId) {
return GenericId.from(relationId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment