mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): Allow negative rating (for rejected images) (#15699)
Allow negative rating (for rejected images)
This commit is contained in:
parent
f44669447f
commit
fe1e09e51f
7 changed files with 31 additions and 6 deletions
|
|
@ -52,7 +52,7 @@ export class UpdateAssetBase {
|
|||
@Optional()
|
||||
@IsInt()
|
||||
@Max(5)
|
||||
@Min(0)
|
||||
@Min(-1)
|
||||
rating?: number;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1162,6 +1162,17 @@ describe(MetadataService.name, () => {
|
|||
}),
|
||||
);
|
||||
});
|
||||
it('should handle valid negative rating value', async () => {
|
||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||
mockReadTags({ Rating: -1 });
|
||||
|
||||
await sut.handleMetadataExtraction({ id: assetStub.image.id });
|
||||
expect(assetMock.upsertExif).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
rating: -1,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('handleQueueSidecar', () => {
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ export class MetadataService extends BaseService {
|
|||
// comments
|
||||
description: String(exifTags.ImageDescription || exifTags.Description || '').trim(),
|
||||
profileDescription: exifTags.ProfileDescription || null,
|
||||
rating: validateRange(exifTags.Rating, 0, 5),
|
||||
rating: validateRange(exifTags.Rating, -1, 5),
|
||||
|
||||
// grouping
|
||||
livePhotoCID: (exifTags.ContentIdentifier || exifTags.MediaGroupUUID) ?? null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue