From f71cef04fa280e2ce177c97176db9fb6c0d89179 Mon Sep 17 00:00:00 2001 From: Peter - Ubuntu dual boot Date: Sat, 18 Sep 2021 20:43:34 +0100 Subject: [PATCH] Fixing album model and index checks. --- api/graphql/models/album.go | 2 +- api/graphql/resolvers/album.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/graphql/models/album.go b/api/graphql/models/album.go index 93b81875..75625488 100644 --- a/api/graphql/models/album.go +++ b/api/graphql/models/album.go @@ -17,7 +17,7 @@ type Album struct { Owners []User `gorm:"many2many:user_albums;constraint:OnDelete:CASCADE;"` Path string `gorm:"not null"` PathHash string `gorm:"unique"` - CoverID int `gorm:"index;"` + CoverID *int } func (a *Album) FilePath() string { diff --git a/api/graphql/resolvers/album.go b/api/graphql/resolvers/album.go index c97e5019..83936264 100644 --- a/api/graphql/resolvers/album.go +++ b/api/graphql/resolvers/album.go @@ -152,7 +152,7 @@ func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*mode fmt.Print(obj.CoverID) - if obj.CoverID == 0 { + if obj.CoverID == nil { if err := r.Database.Raw(` WITH recursive sub_albums AS ( SELECT * FROM albums AS root WHERE id = ?