Fixing album model and index checks.
This commit is contained in:
parent
406a3575ef
commit
f71cef04fa
|
@ -17,7 +17,7 @@ type Album struct {
|
||||||
Owners []User `gorm:"many2many:user_albums;constraint:OnDelete:CASCADE;"`
|
Owners []User `gorm:"many2many:user_albums;constraint:OnDelete:CASCADE;"`
|
||||||
Path string `gorm:"not null"`
|
Path string `gorm:"not null"`
|
||||||
PathHash string `gorm:"unique"`
|
PathHash string `gorm:"unique"`
|
||||||
CoverID int `gorm:"index;"`
|
CoverID *int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Album) FilePath() string {
|
func (a *Album) FilePath() string {
|
||||||
|
|
|
@ -152,7 +152,7 @@ func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*mode
|
||||||
|
|
||||||
fmt.Print(obj.CoverID)
|
fmt.Print(obj.CoverID)
|
||||||
|
|
||||||
if obj.CoverID == 0 {
|
if obj.CoverID == nil {
|
||||||
if err := r.Database.Raw(`
|
if err := r.Database.Raw(`
|
||||||
WITH recursive sub_albums AS (
|
WITH recursive sub_albums AS (
|
||||||
SELECT * FROM albums AS root WHERE id = ?
|
SELECT * FROM albums AS root WHERE id = ?
|
||||||
|
|
Loading…
Reference in New Issue