mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-27 03:07:26 +01:00
client: Remove sync code and update moor to drift
This commit is contained in:
parent
b36fe340ad
commit
289f480703
7 changed files with 13 additions and 1034 deletions
|
|
@ -20,21 +20,6 @@ class PartInfo {
|
|||
this.instruments,
|
||||
this.composer,
|
||||
});
|
||||
|
||||
factory PartInfo.fromJson(Map<String, dynamic> json) => PartInfo(
|
||||
part: WorkPart.fromJson(json['part']),
|
||||
instruments: json['instruments']
|
||||
.map<Instrument>((j) => Instrument.fromJson(j))
|
||||
.toList(),
|
||||
composer:
|
||||
json['composer'] != null ? Person.fromJson(json['composer']) : null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'part': part.toJson(),
|
||||
'instruments': instruments.map((i) => i.toJson()).toList(),
|
||||
'composers': composer?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
/// A bundle information on a work.
|
||||
|
|
@ -66,45 +51,6 @@ class WorkInfo {
|
|||
this.parts,
|
||||
this.sections,
|
||||
});
|
||||
|
||||
/// Deserialize work info from JSON.
|
||||
///
|
||||
/// If [sync] is set to true, all contained items will have their sync
|
||||
/// property set to true.
|
||||
// TODO: Local versions should not be overriden, if their sync property is
|
||||
// set to false.
|
||||
factory WorkInfo.fromJson(Map<String, dynamic> json, {bool sync = false}) =>
|
||||
WorkInfo(
|
||||
work: Work.fromJson(json['work']).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
),
|
||||
instruments: json['instruments']
|
||||
.map<Instrument>((j) => Instrument.fromJson(j).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
))
|
||||
.toList(),
|
||||
composers: json['composers']
|
||||
.map<Person>((j) => Person.fromJson(j).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
))
|
||||
.toList(),
|
||||
parts:
|
||||
json['parts'].map<PartInfo>((j) => PartInfo.fromJson(j)).toList(),
|
||||
sections: json['sections']
|
||||
.map<WorkSection>((j) => WorkSection.fromJson(j))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'work': work.toJson(),
|
||||
'instruments': instruments.map((i) => i.toJson()).toList(),
|
||||
'composers': composers.map((c) => c.toJson()).toList(),
|
||||
'parts': parts.map((c) => c.toJson()).toList(),
|
||||
'sections': sections.map((s) => s.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
/// All available information on a performance within a recording.
|
||||
|
|
@ -127,35 +73,6 @@ class PerformanceInfo {
|
|||
this.ensemble,
|
||||
this.role,
|
||||
});
|
||||
|
||||
factory PerformanceInfo.fromJson(Map<String, dynamic> json,
|
||||
{bool sync = false}) =>
|
||||
PerformanceInfo(
|
||||
person: json['person'] != null
|
||||
? Person.fromJson(json['person']).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
)
|
||||
: null,
|
||||
ensemble: json['ensemble'] != null
|
||||
? Ensemble.fromJson(json['ensemble']).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
)
|
||||
: null,
|
||||
role: json['role'] != null
|
||||
? Instrument.fromJson(json['role']).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'person': person?.toJson(),
|
||||
'ensemble': ensemble?.toJson(),
|
||||
'role': role?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
/// All available information on a recording.
|
||||
|
|
@ -173,28 +90,4 @@ class RecordingInfo {
|
|||
this.recording,
|
||||
this.performances,
|
||||
});
|
||||
|
||||
/// Deserialize recording info from JSON.
|
||||
///
|
||||
/// If [sync] is set to true, all contained items will have their sync
|
||||
/// property set to true.
|
||||
// TODO: Local versions should not be overriden, if their sync property is
|
||||
// set to false.
|
||||
factory RecordingInfo.fromJson(Map<String, dynamic> json,
|
||||
{bool sync = false}) =>
|
||||
RecordingInfo(
|
||||
recording: Recording.fromJson(json['recording']).copyWith(
|
||||
sync: sync,
|
||||
synced: sync,
|
||||
),
|
||||
performances: json['performances']
|
||||
.map<PerformanceInfo>(
|
||||
(j) => PerformanceInfo.fromJson(j, sync: sync))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'recording': recording.toJson(),
|
||||
'performances': performances.map((p) => p.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue