mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:59:03 +00:00
Proof of concept for variable album covers - GQL playground working.
This commit is contained in:
@@ -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;default:-1;"`
|
||||
CoverID int `gorm:"index;default:-1;"`
|
||||
}
|
||||
|
||||
func (a *Album) FilePath() string {
|
||||
|
||||
@@ -174,7 +174,6 @@ func (r *albumResolver) Thumbnail(ctx context.Context, obj *models.Album) (*mode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// err := r.Database.Raw(`
|
||||
// WITH recursive sub_albums AS (
|
||||
// SELECT * FROM albums AS root WHERE id = ?
|
||||
@@ -289,8 +288,6 @@ func (r *mutationResolver) SetAlbumCoverID(ctx context.Context, albumID int, cov
|
||||
return nil, errors.New("forbidden")
|
||||
}
|
||||
|
||||
|
||||
|
||||
if err := r.Database.Model(&album).Update("cover_id", coverID).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user