Revert "Fix DB query to fetch owned files"

This reverts commit a6b8d229dd.
This commit is contained in:
Vishnu Mohandas 2020-10-25 02:51:06 +05:30
parent a6b8d229dd
commit fb897e9264

View file

@ -117,16 +117,25 @@ class FilesDB {
final db = await instance.database;
final results = await db.query(table,
where: '$columnGeneratedID = ?', whereArgs: [generatedID]);
return _convertToFiles(results)[0];
final convertedResults = _convertToFiles(results);
if (convertedResults.length == 0) {
return null;
} else {
return convertedResults[1];
}
}
Future<List<File>> getOwnedFiles(int ownerID) async {
final db = await instance.database;
final whereArgs = List<dynamic>();
if (ownerID != null) {
whereArgs.add(ownerID);
}
final results = await db.query(
table,
where: '$columnIsDeleted = 0' +
(ownerID == null ? '' : ' AND $columnOwnerID = ?'),
whereArgs: [ownerID],
// where: '$columnIsDeleted = 0' +
// (ownerID == null ? '' : ' AND $columnOwnerID = ?'),
// whereArgs: whereArgs,
orderBy: '$columnCreationTime DESC',
);
return _convertToFiles(results);