From 2552ba8e94a4b6153b0411dee4665c1dfad00dd1 Mon Sep 17 00:00:00 2001 From: Arthur Lefebvre Date: Sat, 4 Apr 2026 23:15:44 +0200 Subject: [PATCH] Collection: new widget to add book to collection --- front/src/AddBookToCollection.vue | 95 +++++++++++++++++++ front/src/CollectionForm.vue | 7 ++ front/src/SearchBook.vue | 10 +- front/src/api.js | 11 ++- .../apitest/post_collection_addbook_test.go | 64 +++++++++++++ internal/apitest/search_book_test.go | 20 ++-- internal/dto/in.go | 16 +++- internal/myvalidator/myvalidator.go | 3 + internal/routes/booksearchget.go | 4 +- internal/routes/collectionaddbookpost.go | 62 ++++++++++++ internal/setup/setup.go | 3 + 11 files changed, 279 insertions(+), 16 deletions(-) create mode 100644 front/src/AddBookToCollection.vue create mode 100644 internal/apitest/post_collection_addbook_test.go create mode 100644 internal/routes/collectionaddbookpost.go diff --git a/front/src/AddBookToCollection.vue b/front/src/AddBookToCollection.vue new file mode 100644 index 0000000..0a7fd79 --- /dev/null +++ b/front/src/AddBookToCollection.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/front/src/CollectionForm.vue b/front/src/CollectionForm.vue index 7636d01..dbd9042 100644 --- a/front/src/CollectionForm.vue +++ b/front/src/CollectionForm.vue @@ -2,6 +2,7 @@ import { computed, ref } from 'vue' import { getCollection } from './api.js' import CollectionFormBookItem from './CollectionFormBookItem.vue' +import AddBookToCollection from './AddBookToCollection.vue' import Pagination from './Pagination.vue' const props = defineProps({ @@ -27,14 +28,20 @@ getCollection(data, error, props.id, limit, offset.value) function pageChange(newPageNumber) { pageNumber.value = newPageNumber data.value = null + error.value = null getCollection(data, error, props.id, limit, offset.value) } + +function fetchCollection() { + pageChange(1) +}