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

@@ -271,7 +271,7 @@ export interface Subscription {
iconUrl: string
unread: number
categoryId?: string
position?: number
position: number
newestItemTime?: number
filter?: string
}

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;
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="position-required" author="athou">
<update tableName="FEEDCATEGORIES">
<column name="position" valueNumeric="0" />
<where>position is null</where>
</update>
<addNotNullConstraint tableName="FEEDCATEGORIES" columnName="position" columnDataType="int" />
<update tableName="FEEDSUBSCRIPTIONS">
<column name="position" valueNumeric="0" />
<where>position is null</where>
</update>
<addNotNullConstraint tableName="FEEDSUBSCRIPTIONS" columnName="position" columnDataType="int" />
</changeSet>
</databaseChangeLog>

View File

@@ -19,5 +19,6 @@
<include file="changelogs/db.changelog-2.6.xml" />
<include file="changelogs/db.changelog-3.2.xml" />
<include file="changelogs/db.changelog-3.5.xml" />
<include file="changelogs/db.changelog-3.6.xml" />
</databaseChangeLog>