From ecb7badaf390087868644ca6bc4dd8a21b93e111 Mon Sep 17 00:00:00 2001 From: Robert Goniszewski Date: Wed, 20 Nov 2024 21:26:11 +0100 Subject: [PATCH] feat(import): implement WIP bookmark import execution with metadata support Signed-off-by: Robert Goniszewski --- run-dev.sh | 1 + .../BulkListItem/BulkListItem.svelte | 79 +++++----- .../EditBookmarkForm/EditBookmarkForm.svelte | 10 +- src/lib/stores/import-bookmarks.store.ts | 4 + src/lib/types/BookmarkImport.type.ts | 13 +- .../utils/bookmark-import/execute-import.ts | 139 ++++++++++++++++++ src/routes/api/bookmarks/import/+server.ts | 54 +++++++ src/routes/import/html/+page.svelte | 76 +++++++++- 8 files changed, 336 insertions(+), 40 deletions(-) create mode 100644 src/lib/utils/bookmark-import/execute-import.ts create mode 100644 src/routes/api/bookmarks/import/+server.ts diff --git a/run-dev.sh b/run-dev.sh index 0a3a9a5..c1663c9 100755 --- a/run-dev.sh +++ b/run-dev.sh @@ -2,6 +2,7 @@ trap 'echo "Received SIGINT or SIGTERM. Exiting..." >&2; exit 1' SIGINT SIGTERM +bun --bun run run-migrations bun --bun run dev kill -- -$$ \ No newline at end of file diff --git a/src/lib/components/BulkListItem/BulkListItem.svelte b/src/lib/components/BulkListItem/BulkListItem.svelte index 42368a0..210952a 100644 --- a/src/lib/components/BulkListItem/BulkListItem.svelte +++ b/src/lib/components/BulkListItem/BulkListItem.svelte @@ -1,6 +1,7 @@ {#if $step === 1} @@ -154,7 +191,7 @@ const onSetSelectedCategory = () => {
{#if $isAnySelected && !$isFetchingMetadata} @@ -202,4 +239,35 @@ const onSetSelectedCategory = () => { items={$itemsCount} position="right" />
+{:else if $step === 3} +
+

Import results

+
+ {#if $importResult.successful} +
+
+ Success! + + {$importResult.successful} bookmarks imported successfully. + +
+
+ {/if} + {#if $importResult.failed} +
+
+ Error! + + {$importResult.failed} bookmarks failed to import. + +
+
+ {/if} +
+ + Total bookmarks: {$importResult.total} + +
+
+
{/if}