position is now always set (#1076)

This commit is contained in:
Athou
2023-06-15 21:06:51 +02:00
parent 68c62b4528
commit b16978d8fe
8 changed files with 29 additions and 7 deletions

View File

@@ -38,6 +38,6 @@ public class FeedCategory extends AbstractModel {
private boolean collapsed;
private Integer position;
private int position;
}

View File

@@ -38,7 +38,7 @@ public class FeedSubscription extends AbstractModel {
@OneToMany(mappedBy = "subscription", cascade = CascadeType.REMOVE)
private Set<FeedEntryStatus> statuses;
private Integer position;
private int position;
@Column(name = "filtering_expression", length = 4096)
private String filter;

View File

@@ -35,5 +35,5 @@ public class Category implements Serializable {
private boolean expanded;
@ApiModelProperty(value = "position of the category in the list", required = true)
private Integer position;
private int position;
}

View File

@@ -54,7 +54,7 @@ public class Subscription implements Serializable {
private String categoryId;
@ApiModelProperty("position of the subscription's in the list")
private Integer position;
private int position;
@ApiModelProperty(value = "date of the newest item", dataType = "number")
private Date newestItemTime;

View File

@@ -458,7 +458,7 @@ public class CategoryREST {
category.getChildren().add(child);
}
}
Collections.sort(category.getChildren(), (o1, o2) -> ObjectUtils.compare(o1.getPosition(), o2.getPosition()));
category.getChildren().sort(Comparator.comparing(Category::getPosition).thenComparing(Category::getName));
for (FeedSubscription subscription : subscriptions) {
if (id == null && subscription.getCategory() == null
@@ -468,7 +468,7 @@ public class CategoryREST {
category.getFeeds().add(sub);
}
}
Collections.sort(category.getFeeds(), (o1, o2) -> ObjectUtils.compare(o1.getPosition(), o2.getPosition()));
category.getFeeds().sort(Comparator.comparing(Subscription::getPosition).thenComparing(Subscription::getName));
return category;
}