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(
|
final missingCount = await _c.npDb.countFilesByMissingMetadata(
|
||||||
account: account.toDb(),
|
account: account.toDb(),
|
||||||
mimes: file_util.supportedImageFormatMimes,
|
mimes: file_util.supportedImageFormatMimes,
|
||||||
|
ownerId: account.userId.toCaseInsensitiveString(),
|
||||||
);
|
);
|
||||||
_log.info("[_startMetadataTask] Missing count: $missingCount");
|
_log.info("[_startMetadataTask] Missing count: $missingCount");
|
||||||
if (missingCount > 0) {
|
if (missingCount > 0) {
|
||||||
|
|
|
@ -351,6 +351,7 @@ abstract class NpDb {
|
||||||
Future<int> countFilesByMissingMetadata({
|
Future<int> countFilesByMissingMetadata({
|
||||||
required DbAccount account,
|
required DbAccount account,
|
||||||
required List<String> mimes,
|
required List<String> mimes,
|
||||||
|
required String ownerId,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Delete a file or dir from db
|
/// Delete a file or dir from db
|
||||||
|
|
|
@ -340,6 +340,7 @@ extension SqliteDbFileExtension on SqliteDb {
|
||||||
required ByAccount account,
|
required ByAccount account,
|
||||||
bool? isMissingMetadata,
|
bool? isMissingMetadata,
|
||||||
List<String>? mimes,
|
List<String>? mimes,
|
||||||
|
String? ownerId,
|
||||||
}) async {
|
}) async {
|
||||||
_log.info(
|
_log.info(
|
||||||
"[countFiles] isMissingMetadata: $isMissingMetadata, mimes: $mimes");
|
"[countFiles] isMissingMetadata: $isMissingMetadata, mimes: $mimes");
|
||||||
|
@ -380,6 +381,9 @@ extension SqliteDbFileExtension on SqliteDb {
|
||||||
if (mimes != null) {
|
if (mimes != null) {
|
||||||
query.where(files.contentType.isIn(mimes));
|
query.where(files.contentType.isIn(mimes));
|
||||||
}
|
}
|
||||||
|
if (ownerId != null) {
|
||||||
|
query.where(files.ownerId.equals(ownerId));
|
||||||
|
}
|
||||||
return await query.map((r) => r.read(count)!).getSingle();
|
return await query.map((r) => r.read(count)!).getSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,12 +383,14 @@ class NpDbSqlite implements NpDb {
|
||||||
Future<int> countFilesByMissingMetadata({
|
Future<int> countFilesByMissingMetadata({
|
||||||
required DbAccount account,
|
required DbAccount account,
|
||||||
required List<String> mimes,
|
required List<String> mimes,
|
||||||
|
required String ownerId,
|
||||||
}) async {
|
}) async {
|
||||||
return _db.use((db) async {
|
return _db.use((db) async {
|
||||||
return await db.countFiles(
|
return await db.countFiles(
|
||||||
account: ByAccount.db(account),
|
account: ByAccount.db(account),
|
||||||
isMissingMetadata: true,
|
isMissingMetadata: true,
|
||||||
mimes: mimes,
|
mimes: mimes,
|
||||||
|
ownerId: ownerId,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue