Refactor collection header query to remove warning
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user