Use usual book widget for collection form view
This commit is contained in:
@@ -10,19 +10,6 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func CollectionQueryToCollectionDto(collectionsQueryResult []query.CollectionsQueryResult) dto.CollectionGet {
|
||||
var collection dto.CollectionGet
|
||||
for _, collectionsDb := range collectionsQueryResult {
|
||||
collection.Name = collectionsDb.Name
|
||||
book := collectionDbToBookItem(&collectionsDb)
|
||||
if book != nil {
|
||||
collection.Books = append(collection.Books, *book)
|
||||
}
|
||||
collection.UserID = collectionsDb.UserID
|
||||
}
|
||||
return collection
|
||||
}
|
||||
|
||||
func CollectionQueryToCollectionItemDto(collectionsQueryResult []query.CollectionsQueryResult) []dto.CollectionItemGet {
|
||||
var collections []dto.CollectionItemGet
|
||||
for _, collectionDb := range collectionsQueryResult {
|
||||
@@ -35,7 +22,7 @@ func CollectionQueryToCollectionItemDto(collectionsQueryResult []query.Collectio
|
||||
//current collection is the last element
|
||||
i = len(collections) - 1
|
||||
}
|
||||
book := collectionDbToBookItem(&collectionDb)
|
||||
book := collectionDbToCollectionBookItem(&collectionDb)
|
||||
if book != nil {
|
||||
collections[i].Books = append(collections[i].Books, *book)
|
||||
}
|
||||
@@ -43,7 +30,7 @@ func CollectionQueryToCollectionItemDto(collectionsQueryResult []query.Collectio
|
||||
return collections
|
||||
}
|
||||
|
||||
func collectionDbToBookItem(collectionDb *query.CollectionsQueryResult) *dto.CollectionBookItemGet {
|
||||
func collectionDbToCollectionBookItem(collectionDb *query.CollectionsQueryResult) *dto.CollectionBookItemGet {
|
||||
if collectionDb.BookId > 0 {
|
||||
bookItem := dto.CollectionBookItemGet{
|
||||
ID: collectionDb.BookId,
|
||||
|
||||
Reference in New Issue
Block a user