getPendingDownSync method

Future<List<OpLogEntry<TaskModel>>> getPendingDownSync(
  1. DataModelType type, {
  2. required String createdBy,
})
inherited

Implementation

Future<List<OpLogEntry<T>>> getPendingDownSync(
  DataModelType type, {
  required String createdBy,
}) async {
  var oplogs = isar.opLogs
      .filter()
      .syncedUpEqualTo(true)
      .syncDownRetryCountLessThan(5)
      .syncedDownEqualTo(false)
      .entityTypeEqualTo(type)
      .findAllSync();

  oplogs = oplogs
      .sortedBy((element) => element.createdAt)
      .where(
        (element) =>
            element.entityType != DataModelType.service &&
            element.entityType != DataModelType.userLocation &&
            element.entityType != DataModelType.complaints,
        // Added service so that we don't get the response from the server
      )
      .toList();

  return oplogs.map((e) => OpLogEntry.fromOpLog<T>(e)).toList();
}