request method
Future<void>
request(
- A data
)
override
Implementation
@override
Future<void> request(A data) async {
final dbStore = DbStoresWeebi().articles;
final recordSnapshot = await dbStore.find(_database.db);
if (recordSnapshot.isEmpty) {
throw 'no articles';
}
final key = await dbStore.findKey(_database.db,
finder: Finder(filter: Filter.equals('id', data.calibreId)));
if (key == null) {
throw 'error no match for calibreId ${data.calibreId} in deleteforeverArticle';
}
final lineSnap = await dbStore.record(key).get(_database.db);
if (lineSnap == null) {
throw 'error lineSnap is null in deleteforeverArticle';
}
final line = CalibreWeebi.fromMap(lineSnap, isProto: false);
final articleIndex = line.articles.indexWhere((p) => p.id == data.id);
line.articles.removeAt(articleIndex);
return;
}