File tree Expand file tree Collapse file tree
rentplace/src/main/java/kattsyn/dev/rentplace Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import lombok .NoArgsConstructor ;
1616import lombok .Setter ;
1717
18+ import java .util .List ;
1819import java .util .Set ;
1920
2021@ NoArgsConstructor
@@ -88,7 +89,7 @@ NOT PUBLISHED (не опубликовано) - объявление уже пр
8889 private UserDTO ownerDTO ;
8990
9091 @ Schema (description = "Фотографии жилья" )
91- private Set <ImageDTO > imagesDTOs ;
92+ private List <ImageDTO > imagesDTOs ;
9293
9394 @ Schema (description = "Категории жилья" )
9495 private Set <CategoryDTO > categoriesDTOs ;
Original file line number Diff line number Diff line change 2727import org .springframework .web .multipart .MultipartFile ;
2828
2929import java .util .ArrayList ;
30+ import java .util .Comparator ;
3031import java .util .HashSet ;
3132import java .util .List ;
3233
@@ -102,7 +103,9 @@ public Property getPropertyById(long id) {
102103 @ Transactional
103104 @ Override
104105 public PropertyDTO findById (long id ) {
105- return propertyMapper .fromProperty (getPropertyById (id ));
106+ PropertyDTO propertyDTO = propertyMapper .fromProperty (getPropertyById (id ));
107+ propertyDTO .getImagesDTOs ().sort (Comparator .comparing (ImageDTO ::isPreviewImage ).reversed ().thenComparing (ImageDTO ::getImageId ));
108+ return propertyDTO ;
106109 }
107110
108111
You can’t perform that action at this time.
0 commit comments