mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Show persons and ensembles in main window
This commit is contained in:
parent
9101fb053d
commit
cca722dcba
4 changed files with 157 additions and 27 deletions
|
|
@ -349,6 +349,21 @@ impl Database {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn get_recordings_for_ensemble(&self, id: i64) -> Vec<RecordingDescription> {
|
||||
let recordings = recordings::table
|
||||
.inner_join(performances::table.on(performances::recording.eq(recordings::id)))
|
||||
.inner_join(ensembles::table.on(ensembles::id.nullable().eq(performances::ensemble)))
|
||||
.filter(ensembles::id.eq(id))
|
||||
.select(recordings::table::all_columns())
|
||||
.load::<Recording>(&self.c)
|
||||
.expect("Error loading recordings for ensemble!");
|
||||
|
||||
recordings
|
||||
.iter()
|
||||
.map(|recording| self.get_recording_description_for_recording(recording.clone()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn delete_recording(&self, id: i64) {
|
||||
diesel::delete(recordings::table.filter(recordings::id.eq(id)))
|
||||
.execute(&self.c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue