more fixes

This commit is contained in:
shenlong-tanwen
2025-09-04 18:28:02 +05:30
parent 254ca4a13d
commit 9cf5d83707
6 changed files with 41 additions and 29 deletions
@@ -37,5 +37,6 @@ extension LocalAssetEntityDataDomainExtension on LocalAssetEntityData {
width: width,
remoteId: null,
orientation: orientation,
cloudId: cloudId,
);
}
@@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:drift/drift.dart';
import 'package:drift/extensions/json1.dart';
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
@@ -17,7 +15,7 @@ class RemoteAssetMetadataEntity extends Table with DriftDefaultsMixin {
BlobColumn get value => blob().map(assetMetadataConverter)();
TextColumn get cloudId => text().generatedAs(key.jsonExtract(r'$.iCloudId'), stored: true)();
TextColumn get cloudId => text().generatedAs(value.jsonExtract(r'$.iCloudId'), stored: true).nullable()();
@override
Set<Column> get primaryKey => {assetId, key};
@@ -25,5 +23,4 @@ class RemoteAssetMetadataEntity extends Table with DriftDefaultsMixin {
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?> assetMetadataConverter = TypeConverter.jsonb(
fromJson: (json) => json as Map<String, Object?>,
toJson: (value) => jsonEncode(value),
);
@@ -425,9 +425,9 @@ class $RemoteAssetMetadataEntityTable extends i3.RemoteAssetMetadataEntity
late final i0.GeneratedColumn<String> cloudId = i0.GeneratedColumn<String>(
'cloud_id',
aliasedName,
false,
true,
generatedAs: i0.GeneratedAs(
i4.JsonExtensions(key).jsonExtract(r'$.iCloudId'),
i4.JsonbExtensions(value).jsonExtract(r'$.iCloudId'),
true,
),
type: i0.DriftSqlType.string,
@@ -498,7 +498,7 @@ class $RemoteAssetMetadataEntityTable extends i3.RemoteAssetMetadataEntity
cloudId: attachedDatabase.typeMapping.read(
i0.DriftSqlType.string,
data['${effectivePrefix}cloud_id'],
)!,
),
);
}
@@ -520,12 +520,12 @@ class RemoteAssetMetadataEntityData extends i0.DataClass
final String assetId;
final String key;
final Map<String, Object?> value;
final String cloudId;
final String? cloudId;
const RemoteAssetMetadataEntityData({
required this.assetId,
required this.key,
required this.value,
required this.cloudId,
this.cloudId,
});
@override
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
@@ -551,7 +551,7 @@ class RemoteAssetMetadataEntityData extends i0.DataClass
value: i1.$RemoteAssetMetadataEntityTable.$convertervalue.fromJson(
serializer.fromJson<Object?>(json['value']),
),
cloudId: serializer.fromJson<String>(json['cloudId']),
cloudId: serializer.fromJson<String?>(json['cloudId']),
);
}
@override
@@ -563,7 +563,7 @@ class RemoteAssetMetadataEntityData extends i0.DataClass
'value': serializer.toJson<Object?>(
i1.$RemoteAssetMetadataEntityTable.$convertervalue.toJson(value),
),
'cloudId': serializer.toJson<String>(cloudId),
'cloudId': serializer.toJson<String?>(cloudId),
};
}
@@ -571,12 +571,12 @@ class RemoteAssetMetadataEntityData extends i0.DataClass
String? assetId,
String? key,
Map<String, Object?>? value,
String? cloudId,
i0.Value<String?> cloudId = const i0.Value.absent(),
}) => i1.RemoteAssetMetadataEntityData(
assetId: assetId ?? this.assetId,
key: key ?? this.key,
value: value ?? this.value,
cloudId: cloudId ?? this.cloudId,
cloudId: cloudId.present ? cloudId.value : this.cloudId,
);
@override
String toString() {