request method
Future<BoutiqueWeebi>
request(
- BoutiqueWeebi data
)
override
Implementation
@override
Future<BoutiqueWeebi> request(BoutiqueWeebi data) async {
final dbStore = DbStoresWeebi.boutique; // ==boutique
final snap = await dbStore.find(_database.db,
finder: Finder(
filter: Filter.and([
Filter.equals('creationDate', data.creationDate.toIso8601String())
])));
if (snap.isEmpty || snap.length > 1) {
// there is a single boutique
// this boutique must be updated
// because of weird legacy stuff we drop the whole
await dbStore.drop(_database.dbS);
await dbStore.add(_database.dbS, data.toMap());
return data;
} else {
await dbStore.update(_database.db, data.toMap(),
finder: Finder(
filter: Filter.and([
Filter.equals('creationDate', data.creationDate.toIso8601String())
])));
return BoutiqueWeebi.fromMap(dbStore.findFirstSync(_database.db)!.value);
}
}