Skip to content
Snippets Groups Projects
Verified Commit 21a2b4d9 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

fix: Delete done right

parent 8f4c4c2a
No related branches found
No related tags found
No related merge requests found
...@@ -242,7 +242,7 @@ func (st *Store) GetFileUsage(showID uint64, id uint64) (playlists []Playlist, e ...@@ -242,7 +242,7 @@ func (st *Store) GetFileUsage(showID uint64, id uint64) (playlists []Playlist, e
func (st *Store) DeleteFile(showID uint64, id uint64) (err error) { func (st *Store) DeleteFile(showID uint64, id uint64) (err error) {
// make sure the file actually belongs to <show> since permissions are enforced // make sure the file actually belongs to <show> since permissions are enforced
// based on show membership // based on show membership
result := st.db.Where("show_id = ?", showID).Delete(&File{ID: id}) result := st.db.Where("show_id = ?", showID).Delete(File{ID: id})
if err = result.Error; err != nil { if err = result.Error; err != nil {
// we assume this is due to a FK constraint -> file in use by playlist_entry // we assume this is due to a FK constraint -> file in use by playlist_entry
usageErr := &ErrFileInUse{} usageErr := &ErrFileInUse{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment