implemented transition from old bookmark database (tags.db) to separate database for bookmarks and tags

This commit is contained in:
2025-08-06 01:22:25 +02:00
parent deb9a7b5c7
commit 6f1fdc1f95
7 changed files with 84 additions and 34 deletions

View File

@@ -13,20 +13,20 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
public record Bookmark(long id, String url, String comment, LocalDateTime timestamp, Collection<String> tags) implements Mappable {
public record Bookmark(long urlId, String url, String comment, LocalDateTime timestamp, Collection<String> tags) implements Mappable {
public static Bookmark of(ResultSet rs) throws SQLException {
return new Bookmark(rs.getLong(ID),rs.getString(URL),rs.getString(COMMENT),LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP),0, UTC),new ArrayList<>());
}
public static Bookmark of(long id, String url, String comment, LocalDateTime timestamp){
return new Bookmark(id,url,comment,timestamp,new ArrayList<>());
public static Bookmark of(long urlId, String url, String comment, LocalDateTime timestamp){
return new Bookmark(urlId,url,comment,timestamp,new ArrayList<>());
}
@Override
public Map<String, Object> toMap() {
return Map.of(
ID,id,
ID, urlId,
URL, url,
COMMENT, Map.of(SOURCE,comment,RENDERED,markdown(comment)),
TAGS, tags,