Исправлены дублирующиеся пакеты

This commit is contained in:
sshkurov
2022-02-04 08:10:24 +03:00
parent cf90c1e758
commit d255584555
2 changed files with 2 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ public interface StreamRepository extends JpaRepository<Stream, Long>, JpaSpecif
long deleteByEndTimestampBeforeAndFavoriteIsFalse(long threshold);
@Query("SELECT s FROM Stream s " +
"LEFT JOIN FETCH s.packets AS packets " +
"JOIN FETCH s.packets AS packets " +
"LEFT JOIN FETCH packets.matches " +
"WHERE s.id = :id"
)

View File

@@ -247,6 +247,7 @@ public class StreamService {
public List<Packet> getPackets(long streamId) {
return repository.getStreamWithPackets(streamId)
.map(Stream::getPackets)
.map(packets -> packets.stream().distinct().collect(Collectors.toList()))
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
}