Refactor collection header query to remove warning

This commit is contained in:
2026-04-08 15:35:00 +02:00
parent dbf0face76
commit aca2a2c339
3 changed files with 14 additions and 8 deletions

View File

@@ -6,9 +6,14 @@ import (
"gorm.io/gorm"
)
type CollectionHeader struct {
Name string
UserID uint
}
// collection header without the books
func FetchCollectionHeader(db *gorm.DB, collectionId uint) (dto.CollectionGet, error) {
var collection dto.CollectionGet
func FetchCollectionHeader(db *gorm.DB, collectionId uint) (CollectionHeader, error) {
var collection CollectionHeader
query := db.Model(&model.Collection{})
query = query.Select("collections.name, collections.user_id")
query = query.Where("collections.id = ?", collectionId)