mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Add use case to list archived files
This commit is contained in:
parent
7b98a282ed
commit
692ccd2e9e
5 changed files with 35 additions and 0 deletions
13
app/lib/use_case/list_archived_file.dart
Normal file
13
app/lib/use_case/list_archived_file.dart
Normal file
|
@ -0,0 +1,13 @@
|
|||
import 'package:nc_photos/account.dart';
|
||||
import 'package:nc_photos/di_container.dart';
|
||||
import 'package:nc_photos/entity/file_descriptor.dart';
|
||||
|
||||
class ListArchivedFile {
|
||||
const ListArchivedFile(this._c);
|
||||
|
||||
/// Return list of archived files
|
||||
Future<List<FileDescriptor>> call(Account account, String shareDirPath) =>
|
||||
_c.fileRepo2.getFileDescriptors(account, shareDirPath, isArchived: true);
|
||||
|
||||
final DiContainer _c;
|
||||
}
|
|
@ -346,6 +346,7 @@ abstract class NpDb {
|
|||
List<String>? relativePathKeywords,
|
||||
String? location,
|
||||
bool? isFavorite,
|
||||
bool? isArchived,
|
||||
List<String>? mimes,
|
||||
TimeRange? timeRange,
|
||||
int? offset,
|
||||
|
|
|
@ -401,6 +401,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
List<String>? relativePathKeywords,
|
||||
String? location,
|
||||
bool? isFavorite,
|
||||
bool? isArchived,
|
||||
List<String>? mimes,
|
||||
TimeRange? timeRange,
|
||||
int? offset,
|
||||
|
@ -415,6 +416,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
"relativePathKeywords: $relativePathKeywords, "
|
||||
"location: $location, "
|
||||
"isFavorite: $isFavorite, "
|
||||
"isArchived: $isArchived, "
|
||||
"mimes: $mimes, "
|
||||
"timeRange: $timeRange, "
|
||||
"offset: $offset, "
|
||||
|
@ -477,6 +479,9 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
if (isFavorite != null) {
|
||||
q.byFavorite(isFavorite);
|
||||
}
|
||||
if (isArchived != null) {
|
||||
q.byArchived(isArchived);
|
||||
}
|
||||
return q.build();
|
||||
});
|
||||
if (excludeRelativeRoots != null) {
|
||||
|
|
|
@ -87,6 +87,10 @@ class FilesQueryBuilder {
|
|||
_byFavorite = favorite;
|
||||
}
|
||||
|
||||
void byArchived(bool archived) {
|
||||
_byArchived = archived;
|
||||
}
|
||||
|
||||
void byDirRowId(int dirRowId) {
|
||||
_byDirRowId = dirRowId;
|
||||
}
|
||||
|
@ -188,6 +192,15 @@ class FilesQueryBuilder {
|
|||
db.accountFiles.isFavorite.isNull());
|
||||
}
|
||||
}
|
||||
if (_byArchived != null) {
|
||||
if (_byArchived!) {
|
||||
query.where(db.accountFiles.isArchived.equals(true));
|
||||
} else {
|
||||
// null are treated as false
|
||||
query.where(db.accountFiles.isArchived.equals(false) |
|
||||
db.accountFiles.isArchived.isNull());
|
||||
}
|
||||
}
|
||||
if (_byDirRowId != null) {
|
||||
query.where(db.dirFiles.dir.equals(_byDirRowId!));
|
||||
}
|
||||
|
@ -232,6 +245,7 @@ class FilesQueryBuilder {
|
|||
List<int>? _byOrDirRowIds;
|
||||
List<String>? _byMimePatterns;
|
||||
bool? _byFavorite;
|
||||
bool? _byArchived;
|
||||
int? _byDirRowId;
|
||||
int? _byServerRowId;
|
||||
String? _byLocation;
|
||||
|
|
|
@ -443,6 +443,7 @@ class NpDbSqlite implements NpDb {
|
|||
List<String>? relativePathKeywords,
|
||||
String? location,
|
||||
bool? isFavorite,
|
||||
bool? isArchived,
|
||||
List<String>? mimes,
|
||||
TimeRange? timeRange,
|
||||
int? offset,
|
||||
|
@ -458,6 +459,7 @@ class NpDbSqlite implements NpDb {
|
|||
relativePathKeywords: relativePathKeywords,
|
||||
location: location,
|
||||
isFavorite: isFavorite,
|
||||
isArchived: isArchived,
|
||||
mimes: mimes,
|
||||
timeRange: timeRange,
|
||||
offset: offset,
|
||||
|
|
Loading…
Reference in a new issue