Added edit bookmark

This commit is contained in:
Juan Gilsanz Polo
2024-02-27 15:44:07 +01:00
parent 8a968be6e0
commit 2c59310f94
14 changed files with 161 additions and 72 deletions

View File

@@ -1,5 +1,7 @@
import 'package:linkdy/models/data/bookmarks.dart';
class CheckBookmark {
final dynamic bookmark;
final Bookmark? bookmark;
final Metadata? metadata;
CheckBookmark({
@@ -8,12 +10,12 @@ class CheckBookmark {
});
factory CheckBookmark.fromJson(Map<String, dynamic> json) => CheckBookmark(
bookmark: json["bookmark"],
bookmark: json["bookmark"] != null ? Bookmark.fromJson(json["bookmark"]) : null,
metadata: json["metadata"] == null ? null : Metadata.fromJson(json["metadata"]),
);
Map<String, dynamic> toJson() => {
"bookmark": bookmark,
"bookmark": bookmark?.toJson(),
"metadata": metadata?.toJson(),
};
}

View File

@@ -6,6 +6,7 @@ class SetBookmarkData {
final bool unread;
final bool shared;
final String tagNames;
final String notes;
const SetBookmarkData({
required this.url,
@@ -15,6 +16,7 @@ class SetBookmarkData {
required this.unread,
required this.shared,
required this.tagNames,
required this.notes,
});
Map<String, dynamic> toJson() {
@@ -25,6 +27,7 @@ class SetBookmarkData {
"is_archived": isArchived,
"unread": unread,
"shared": shared,
"notes": notes,
};
if (tagNames != "") {
ret = {