Skip to content

High performance self-hosted photo and video management solution.

fix(server): set modifydate (#16225)

Jonathan Jogenforsb0102f80255e
diff --git a/server/src/queries/view.repository.sql b/server/src/queries/view.repository.sql
index daa4159ea0..1510521526 100644
--- a/server/src/queries/view.repository.sql
+++ b/server/src/queries/view.repository.sql
@@ -10,7 +10,7 @@ where
and "isVisible" = $3
and "isArchived" = $4
and "deletedAt" is null
- and "fileModifiedAt" is not null
+ and "fileCreatedAt" is not null
and "fileModifiedAt" is not null
and "localDateTime" is not null
@@ -26,7 +26,7 @@ where
and "isVisible" = $2
and "isArchived" = $3
and "deletedAt" is null
- and "fileModifiedAt" is not null
+ and "fileCreatedAt" is not null
and "fileModifiedAt" is not null
and "localDateTime" is not null
and "originalPath" like $4
diff --git a/server/src/repositories/view-repository.ts b/server/src/repositories/view-repository.ts
index 4fa670339e..ae2303e9e2 100644
--- a/server/src/repositories/view-repository.ts
+++ b/server/src/repositories/view-repository.ts
@@ -18,7 +18,7 @@ export class ViewRepository {
.where('isVisible', '=', true)
.where('isArchived', '=', false)
.where('deletedAt', 'is', null)
- .where('fileModifiedAt', 'is not', null)
+ .where('fileCreatedAt', 'is not', null)
.where('fileModifiedAt', 'is not', null)
.where('localDateTime', 'is not', null)
.execute();
@@ -38,7 +38,7 @@ export class ViewRepository {
.where('isVisible', '=', true)
.where('isArchived', '=', false)
.where('deletedAt', 'is', null)
- .where('fileModifiedAt', 'is not', null)
+ .where('fileCreatedAt', 'is not', null)
.where('fileModifiedAt', 'is not', null)
.where('localDateTime', 'is not', null)
.where('originalPath', 'like', `%${normalizedPath}/%`)
diff --git a/server/src/services/metadata.service.spec.ts b/server/src/services/metadata.service.spec.ts
index 0e0c6546ca..f5b10aa379 100644
--- a/server/src/services/metadata.service.spec.ts
+++ b/server/src/services/metadata.service.spec.ts
@@ -227,6 +227,7 @@ describe(MetadataService.name, () => {
id: assetStub.image.id,
duration: null,
fileCreatedAt: sidecarDate,
+ fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
localDateTime: sidecarDate,
});
});
@@ -246,6 +247,7 @@ describe(MetadataService.name, () => {
id: assetStub.image.id,
duration: null,
fileCreatedAt: fileModifiedAt,
+ fileModifiedAt,
localDateTime: fileModifiedAt,
});
});
@@ -263,6 +265,7 @@ describe(MetadataService.name, () => {
id: assetStub.image.id,
duration: null,
fileCreatedAt,
+ fileModifiedAt,
localDateTime: fileCreatedAt,
});
});
@@ -297,6 +300,7 @@ describe(MetadataService.name, () => {
id: assetStub.image.id,
duration: null,
fileCreatedAt: assetStub.image.fileCreatedAt,
+ fileModifiedAt: assetStub.image.fileModifiedAt,
localDateTime: assetStub.image.fileCreatedAt,
});
});
@@ -319,6 +323,7 @@ describe(MetadataService.name, () => {
id: assetStub.withLocation.id,
duration: null,
fileCreatedAt: assetStub.withLocation.createdAt,
+ fileModifiedAt: assetStub.withLocation.createdAt,
localDateTime: new Date('2023-02-22T05:06:29.716Z'),
});
});
@@ -840,6 +845,7 @@ describe(MetadataService.name, () => {
id: assetStub.image.id,
duration: null,
fileCreatedAt: dateForTest,
+ fileModifiedAt: dateForTest,
localDateTime: dateForTest,
});
});
diff --git a/server/src/services/metadata.service.ts b/server/src/services/metadata.service.ts
index 37ec7fa064..02499a1ac5 100644
--- a/server/src/services/metadata.service.ts
+++ b/server/src/services/metadata.service.ts
@@ -238,6 +238,7 @@ export class MetadataService extends BaseService {
duration: exifTags.Duration?.toString() ?? null,
localDateTime,
fileCreatedAt: exifData.dateTimeOriginal ?? undefined,
+ fileModifiedAt: exifData.modifyDate ?? undefined,
});
await this.assetRepository.upsertJobStatus({