Skip to content

Commit

Permalink
fix: order extensions returned by REST API using build and version
Browse files Browse the repository at this point in the history
  • Loading branch information
teoincontatto committed Dec 15, 2023
1 parent f12d2a9 commit 9864d3b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.stackgres.apiweb.dto.extension.Extension;
Expand Down Expand Up @@ -74,7 +75,8 @@ private Extension getExtension(StackGresExtension source, StackGresCluster clust
.grouped(Function.<StackGresExtensionMetadata>identity()
.andThen(StackGresExtensionMetadata::getVersion)
.andThen(StackGresExtensionVersion::getVersion))
.sorted(t -> t.v2.sorted().findFirst().orElseThrow())
.map(t -> t.map2(Stream::toList))
.sorted(t -> t.v2.stream().sorted().findFirst().orElseThrow())
.map(Tuple2::v1)
.toList());
return transformation;
Expand Down

0 comments on commit 9864d3b

Please sign in to comment.