chore(server): Image description disappears after toggle favorite (#3009)

* Fixed asset rewrite description on toggle favorite

* Fixed description removing error

* Rewrite description condition for asset update

---------

Co-authored-by: Balazs Keszei <balazs.keszei@clbr.hu>
This commit is contained in:
Keszei Balázs 2023-06-28 19:54:48 +02:00 committed by GitHub
parent b4e641548c
commit 6ae5d11ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -260,11 +260,15 @@ export class AssetRepository implements IAssetRepository {
asset.isArchived = dto.isArchived ?? asset.isArchived;
if (asset.exifInfo != null) {
asset.exifInfo.description = dto.description || '';
if (dto.description !== undefined) {
asset.exifInfo.description = dto.description;
}
await this.exifRepository.save(asset.exifInfo);
} else {
const exifInfo = new ExifEntity();
exifInfo.description = dto.description || '';
if (dto.description !== undefined) {
exifInfo.description = dto.description;
}
exifInfo.asset = asset;
await this.exifRepository.save(exifInfo);
asset.exifInfo = exifInfo;