mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-29 20:17:23 +01:00
Support work sections
This commit is contained in:
parent
813fa2e47a
commit
93a5a06b55
6 changed files with 134 additions and 51 deletions
|
|
@ -112,11 +112,17 @@ class Database extends _$Database {
|
|||
));
|
||||
}
|
||||
|
||||
final List<WorkSection> sections = [];
|
||||
for (final section in await sectionsByWork(id).get()) {
|
||||
sections.add(section);
|
||||
}
|
||||
|
||||
return WorkInfo(
|
||||
work: work,
|
||||
instruments: instruments,
|
||||
composers: composers,
|
||||
parts: parts,
|
||||
sections: sections,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -160,8 +166,8 @@ class Database extends _$Database {
|
|||
await transaction(() async {
|
||||
final workId = workInfo.work.id;
|
||||
|
||||
// Delete old work data first. The parts and instrumentations will be
|
||||
// deleted automatically due to their foreign key constraints.
|
||||
// Delete old work data first. The parts, sections and instrumentations
|
||||
// will be deleted automatically due to their foreign key constraints.
|
||||
await deleteWork(workId);
|
||||
|
||||
// This will also include the composers of the work's parts.
|
||||
|
|
@ -194,6 +200,10 @@ class Database extends _$Database {
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (final section in workInfo.sections) {
|
||||
await into(workSections).insert(section);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue