mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Fix not considering owner id when counting files missing metadata
This commit is contained in:
parent
ce0b6d6c05
commit
4eab807524
4 changed files with 8 additions and 0 deletions
|
@ -68,6 +68,7 @@ class MetadataController {
|
|||
final missingCount = await _c.npDb.countFilesByMissingMetadata(
|
||||
account: account.toDb(),
|
||||
mimes: file_util.supportedImageFormatMimes,
|
||||
ownerId: account.userId.toCaseInsensitiveString(),
|
||||
);
|
||||
_log.info("[_startMetadataTask] Missing count: $missingCount");
|
||||
if (missingCount > 0) {
|
||||
|
|
|
@ -351,6 +351,7 @@ abstract class NpDb {
|
|||
Future<int> countFilesByMissingMetadata({
|
||||
required DbAccount account,
|
||||
required List<String> mimes,
|
||||
required String ownerId,
|
||||
});
|
||||
|
||||
/// Delete a file or dir from db
|
||||
|
|
|
@ -340,6 +340,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
required ByAccount account,
|
||||
bool? isMissingMetadata,
|
||||
List<String>? mimes,
|
||||
String? ownerId,
|
||||
}) async {
|
||||
_log.info(
|
||||
"[countFiles] isMissingMetadata: $isMissingMetadata, mimes: $mimes");
|
||||
|
@ -380,6 +381,9 @@ extension SqliteDbFileExtension on SqliteDb {
|
|||
if (mimes != null) {
|
||||
query.where(files.contentType.isIn(mimes));
|
||||
}
|
||||
if (ownerId != null) {
|
||||
query.where(files.ownerId.equals(ownerId));
|
||||
}
|
||||
return await query.map((r) => r.read(count)!).getSingle();
|
||||
}
|
||||
|
||||
|
|
|
@ -383,12 +383,14 @@ class NpDbSqlite implements NpDb {
|
|||
Future<int> countFilesByMissingMetadata({
|
||||
required DbAccount account,
|
||||
required List<String> mimes,
|
||||
required String ownerId,
|
||||
}) async {
|
||||
return _db.use((db) async {
|
||||
return await db.countFiles(
|
||||
account: ByAccount.db(account),
|
||||
isMissingMetadata: true,
|
||||
mimes: mimes,
|
||||
ownerId: ownerId,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue