buildFindFirstOrLastQuery function

DataQueryBuilder buildFindFirstOrLastQuery(
  1. DataQueryBuilder? queryBuilder,
  2. String sortDir, {
  3. List<String>? relations,
})

Implementation

DataQueryBuilder buildFindFirstOrLastQuery(
    DataQueryBuilder? queryBuilder, String sortDir,
    {List<String>? relations}) {
  DataQueryBuilder query = queryBuilder ?? DataQueryBuilder();

  if (relations?.isNotEmpty ?? false) {
    query.loadRelations = relations;
  }

  query.pageSize = 1;
  query.offset = 0;

  query.sortBy ??= ['created $sortDir'];

  return query;
}