mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
position is now always set (#1076)
This commit is contained in:
@@ -271,7 +271,7 @@ export interface Subscription {
|
|||||||
iconUrl: string
|
iconUrl: string
|
||||||
unread: number
|
unread: number
|
||||||
categoryId?: string
|
categoryId?: string
|
||||||
position?: number
|
position: number
|
||||||
newestItemTime?: number
|
newestItemTime?: number
|
||||||
filter?: string
|
filter?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ public class FeedCategory extends AbstractModel {
|
|||||||
|
|
||||||
private boolean collapsed;
|
private boolean collapsed;
|
||||||
|
|
||||||
private Integer position;
|
private int position;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class FeedSubscription extends AbstractModel {
|
|||||||
@OneToMany(mappedBy = "subscription", cascade = CascadeType.REMOVE)
|
@OneToMany(mappedBy = "subscription", cascade = CascadeType.REMOVE)
|
||||||
private Set<FeedEntryStatus> statuses;
|
private Set<FeedEntryStatus> statuses;
|
||||||
|
|
||||||
private Integer position;
|
private int position;
|
||||||
|
|
||||||
@Column(name = "filtering_expression", length = 4096)
|
@Column(name = "filtering_expression", length = 4096)
|
||||||
private String filter;
|
private String filter;
|
||||||
|
|||||||
@@ -35,5 +35,5 @@ public class Category implements Serializable {
|
|||||||
private boolean expanded;
|
private boolean expanded;
|
||||||
|
|
||||||
@ApiModelProperty(value = "position of the category in the list", required = true)
|
@ApiModelProperty(value = "position of the category in the list", required = true)
|
||||||
private Integer position;
|
private int position;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public class Subscription implements Serializable {
|
|||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
@ApiModelProperty("position of the subscription's in the list")
|
@ApiModelProperty("position of the subscription's in the list")
|
||||||
private Integer position;
|
private int position;
|
||||||
|
|
||||||
@ApiModelProperty(value = "date of the newest item", dataType = "number")
|
@ApiModelProperty(value = "date of the newest item", dataType = "number")
|
||||||
private Date newestItemTime;
|
private Date newestItemTime;
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ public class CategoryREST {
|
|||||||
category.getChildren().add(child);
|
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) {
|
for (FeedSubscription subscription : subscriptions) {
|
||||||
if (id == null && subscription.getCategory() == null
|
if (id == null && subscription.getCategory() == null
|
||||||
@@ -468,7 +468,7 @@ public class CategoryREST {
|
|||||||
category.getFeeds().add(sub);
|
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;
|
return category;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -19,5 +19,6 @@
|
|||||||
<include file="changelogs/db.changelog-2.6.xml" />
|
<include file="changelogs/db.changelog-2.6.xml" />
|
||||||
<include file="changelogs/db.changelog-3.2.xml" />
|
<include file="changelogs/db.changelog-3.2.xml" />
|
||||||
<include file="changelogs/db.changelog-3.5.xml" />
|
<include file="changelogs/db.changelog-3.5.xml" />
|
||||||
|
<include file="changelogs/db.changelog-3.6.xml" />
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
Reference in New Issue
Block a user