Delete Songs from Concert

This commit is contained in:
sebastian 2024-11-02 10:40:19 +01:00
parent eac3919710
commit 4649d2ffed
2 changed files with 6 additions and 2 deletions

View File

@ -40,8 +40,8 @@ public interface MusicNoteDAO {
@Query("SELECT m.* FROM music_notes m JOIN concert_songs cs ON m.musicNoteId = cs.musicNoteID WHERE cs.id = :concertID")
List<MusicNote> getAllMusicNotesOfConcert(long concertID);
@Delete
void deleteConcertSong(ConcertSong concertSong);
@Query("DELETE FROM concert_songs WHERE concertID = :concertID AND musicNoteID = :songID")
void deleteConcertSong(long songID, int concertID);
}

View File

@ -82,6 +82,10 @@ public class ConcertDetailFragment extends Fragment {
private void deleteSongFromConcert(MusicNote musicNote) {
this.concertDetailViewModel.deleteConcertSong(musicNote);
new Thread(() -> {
MusicNoteDAO musicNoteDAO = MusicDatabase.getDatabase(getContext()).musicNoteDao();
musicNoteDAO.deleteConcertSong(musicNote.getMusicNoteId(), concert.getId());
}).start();
}
private class LoadConcertSongsTask extends AsyncTask<Void, Void, List<MusicNote>> {