mirror of
https://github.com/immich-app/immich.git
synced 2026-05-22 15:42:32 -04:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95b76ec1be | |||
| a303be5358 | |||
| cbbf7683ee | |||
| e7cc6fed36 | |||
| ecec9a8151 | |||
| 8608afffdc | |||
| 9a280b0140 | |||
| 7baf58ef6d |
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
enum AssetEditAction { rotate, crop, mirror, other }
|
||||||
@@ -22,6 +22,7 @@ sealed class BaseAsset {
|
|||||||
final int? durationInSeconds;
|
final int? durationInSeconds;
|
||||||
final bool isFavorite;
|
final bool isFavorite;
|
||||||
final String? livePhotoVideoId;
|
final String? livePhotoVideoId;
|
||||||
|
final bool isEdited;
|
||||||
|
|
||||||
const BaseAsset({
|
const BaseAsset({
|
||||||
required this.name,
|
required this.name,
|
||||||
@@ -34,6 +35,7 @@ sealed class BaseAsset {
|
|||||||
this.durationInSeconds,
|
this.durationInSeconds,
|
||||||
this.isFavorite = false,
|
this.isFavorite = false,
|
||||||
this.livePhotoVideoId,
|
this.livePhotoVideoId,
|
||||||
|
required this.isEdited,
|
||||||
});
|
});
|
||||||
|
|
||||||
bool get isImage => type == AssetType.image;
|
bool get isImage => type == AssetType.image;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class LocalAsset extends BaseAsset {
|
|||||||
this.adjustmentTime,
|
this.adjustmentTime,
|
||||||
this.latitude,
|
this.latitude,
|
||||||
this.longitude,
|
this.longitude,
|
||||||
|
required super.isEdited,
|
||||||
}) : remoteAssetId = remoteId;
|
}) : remoteAssetId = remoteId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -107,6 +108,7 @@ class LocalAsset extends BaseAsset {
|
|||||||
DateTime? adjustmentTime,
|
DateTime? adjustmentTime,
|
||||||
double? latitude,
|
double? latitude,
|
||||||
double? longitude,
|
double? longitude,
|
||||||
|
bool? isEdited,
|
||||||
}) {
|
}) {
|
||||||
return LocalAsset(
|
return LocalAsset(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
@@ -125,6 +127,7 @@ class LocalAsset extends BaseAsset {
|
|||||||
adjustmentTime: adjustmentTime ?? this.adjustmentTime,
|
adjustmentTime: adjustmentTime ?? this.adjustmentTime,
|
||||||
latitude: latitude ?? this.latitude,
|
latitude: latitude ?? this.latitude,
|
||||||
longitude: longitude ?? this.longitude,
|
longitude: longitude ?? this.longitude,
|
||||||
|
isEdited: isEdited ?? this.isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
this.visibility = AssetVisibility.timeline,
|
this.visibility = AssetVisibility.timeline,
|
||||||
super.livePhotoVideoId,
|
super.livePhotoVideoId,
|
||||||
this.stackId,
|
this.stackId,
|
||||||
|
required super.isEdited,
|
||||||
}) : localAssetId = localId;
|
}) : localAssetId = localId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -61,6 +62,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
stackId: ${stackId ?? "<NA>"},
|
stackId: ${stackId ?? "<NA>"},
|
||||||
checksum: $checksum,
|
checksum: $checksum,
|
||||||
livePhotoVideoId: ${livePhotoVideoId ?? "<NA>"},
|
livePhotoVideoId: ${livePhotoVideoId ?? "<NA>"},
|
||||||
|
isEdited: $isEdited,
|
||||||
}''';
|
}''';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,6 +106,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
AssetVisibility? visibility,
|
AssetVisibility? visibility,
|
||||||
String? livePhotoVideoId,
|
String? livePhotoVideoId,
|
||||||
String? stackId,
|
String? stackId,
|
||||||
|
bool? isEdited,
|
||||||
}) {
|
}) {
|
||||||
return RemoteAsset(
|
return RemoteAsset(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
@@ -122,6 +125,7 @@ class RemoteAsset extends BaseAsset {
|
|||||||
visibility: visibility ?? this.visibility,
|
visibility: visibility ?? this.visibility,
|
||||||
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
|
||||||
stackId: stackId ?? this.stackId,
|
stackId: stackId ?? this.stackId,
|
||||||
|
isEdited: isEdited ?? this.isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,5 +436,6 @@ extension PlatformToLocalAsset on PlatformAsset {
|
|||||||
adjustmentTime: tryFromSecondsSinceEpoch(adjustmentTime, isUtc: true),
|
adjustmentTime: tryFromSecondsSinceEpoch(adjustmentTime, isUtc: true),
|
||||||
latitude: latitude,
|
latitude: latitude,
|
||||||
longitude: longitude,
|
longitude: longitude,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class SearchService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SearchResult(
|
return SearchResult(
|
||||||
assets: response.assets.items.map((e) => e.toDto()).toList(),
|
assets: response.assets.items.map((e) => e.toDto(false)).toList(),
|
||||||
nextPage: response.assets.nextPage?.toInt(),
|
nextPage: response.assets.nextPage?.toInt(),
|
||||||
);
|
);
|
||||||
} catch (error, stackTrace) {
|
} catch (error, stackTrace) {
|
||||||
@@ -54,7 +54,7 @@ class SearchService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension on AssetResponseDto {
|
extension on AssetResponseDto {
|
||||||
RemoteAsset toDto() {
|
RemoteAsset toDto(bool isEdited) {
|
||||||
return RemoteAsset(
|
return RemoteAsset(
|
||||||
id: id,
|
id: id,
|
||||||
name: originalFileName,
|
name: originalFileName,
|
||||||
@@ -77,6 +77,8 @@ extension on AssetResponseDto {
|
|||||||
thumbHash: thumbhash,
|
thumbHash: thumbhash,
|
||||||
localId: null,
|
localId: null,
|
||||||
type: type.toAssetType(),
|
type: type.toAssetType(),
|
||||||
|
// its a remote asset so it will always show the edited version
|
||||||
|
isEdited: isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ class SyncStreamService {
|
|||||||
return;
|
return;
|
||||||
case SyncEntityType.assetDeleteV1:
|
case SyncEntityType.assetDeleteV1:
|
||||||
return _syncStreamRepository.deleteAssetsV1(data.cast());
|
return _syncStreamRepository.deleteAssetsV1(data.cast());
|
||||||
|
case SyncEntityType.assetEditV1:
|
||||||
|
return _syncStreamRepository.updateAssetEditsV1(data.cast());
|
||||||
|
case SyncEntityType.assetEditDeleteV1:
|
||||||
|
return _syncStreamRepository.deleteAssetEditsV1(data.cast());
|
||||||
case SyncEntityType.assetExifV1:
|
case SyncEntityType.assetExifV1:
|
||||||
return _syncStreamRepository.updateAssetsExifV1(data.cast());
|
return _syncStreamRepository.updateAssetsExifV1(data.cast());
|
||||||
case SyncEntityType.assetMetadataV1:
|
case SyncEntityType.assetMetadataV1:
|
||||||
|
|||||||
@@ -133,34 +133,43 @@ Future<void> _populateCloudIds(Drift drift) async {
|
|||||||
typedef _CloudIdMapping = ({String remoteAssetId, LocalAsset localAsset});
|
typedef _CloudIdMapping = ({String remoteAssetId, LocalAsset localAsset});
|
||||||
|
|
||||||
Future<List<_CloudIdMapping>> _fetchCloudIdMappings(Drift drift, String userId) async {
|
Future<List<_CloudIdMapping>> _fetchCloudIdMappings(Drift drift, String userId) async {
|
||||||
|
final isEdited = drift.assetEditEntity.assetId.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
drift.remoteAssetEntity.select().join([
|
drift.remoteAssetEntity.select().join([
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
drift.localAssetEntity,
|
drift.localAssetEntity,
|
||||||
drift.localAssetEntity.checksum.equalsExp(drift.remoteAssetEntity.checksum),
|
drift.localAssetEntity.checksum.equalsExp(drift.remoteAssetEntity.checksum),
|
||||||
),
|
),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
drift.remoteAssetCloudIdEntity,
|
drift.remoteAssetCloudIdEntity,
|
||||||
drift.remoteAssetEntity.id.equalsExp(drift.remoteAssetCloudIdEntity.assetId),
|
drift.remoteAssetEntity.id.equalsExp(drift.remoteAssetCloudIdEntity.assetId),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
])..where(
|
leftOuterJoin(
|
||||||
// Only select assets that have a local cloud ID but either no remote cloud ID or a mismatched eTag
|
drift.assetEditEntity,
|
||||||
drift.localAssetEntity.id.isNotNull() &
|
drift.assetEditEntity.assetId.equalsExp(drift.remoteAssetEntity.id),
|
||||||
drift.localAssetEntity.iCloudId.isNotNull() &
|
useColumns: false,
|
||||||
drift.remoteAssetEntity.ownerId.equals(userId) &
|
),
|
||||||
// Skip locked assets as we cannot update them without unlocking first
|
])
|
||||||
drift.remoteAssetEntity.visibility.isNotValue(AssetVisibility.locked.index) &
|
..addColumns([isEdited])
|
||||||
(drift.remoteAssetCloudIdEntity.cloudId.isNull() |
|
..where(
|
||||||
((drift.remoteAssetCloudIdEntity.adjustmentTime.isNotExp(drift.localAssetEntity.adjustmentTime)) &
|
// Only select assets that have a local cloud ID but either no remote cloud ID or a mismatched eTag
|
||||||
(drift.remoteAssetCloudIdEntity.latitude.isNotExp(drift.localAssetEntity.latitude)) &
|
drift.localAssetEntity.id.isNotNull() &
|
||||||
(drift.remoteAssetCloudIdEntity.longitude.isNotExp(drift.localAssetEntity.longitude)) &
|
drift.localAssetEntity.iCloudId.isNotNull() &
|
||||||
(drift.remoteAssetCloudIdEntity.createdAt.isNotExp(drift.localAssetEntity.createdAt)))),
|
drift.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
);
|
// Skip locked assets as we cannot update them without unlocking first
|
||||||
|
drift.remoteAssetEntity.visibility.isNotValue(AssetVisibility.locked.index) &
|
||||||
|
(drift.remoteAssetCloudIdEntity.cloudId.isNull() |
|
||||||
|
((drift.remoteAssetCloudIdEntity.adjustmentTime.isNotExp(drift.localAssetEntity.adjustmentTime)) &
|
||||||
|
(drift.remoteAssetCloudIdEntity.latitude.isNotExp(drift.localAssetEntity.latitude)) &
|
||||||
|
(drift.remoteAssetCloudIdEntity.longitude.isNotExp(drift.localAssetEntity.longitude)) &
|
||||||
|
(drift.remoteAssetCloudIdEntity.createdAt.isNotExp(drift.localAssetEntity.createdAt)))),
|
||||||
|
);
|
||||||
|
|
||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
return (
|
return (
|
||||||
remoteAssetId: row.read(drift.remoteAssetEntity.id)!,
|
remoteAssetId: row.read(drift.remoteAssetEntity.id)!,
|
||||||
localAsset: row.readTable(drift.localAssetEntity).toDto(),
|
localAsset: row.readTable(drift.localAssetEntity).toDto(isEdited: row.read(isEdited)!),
|
||||||
);
|
);
|
||||||
}).get();
|
}).get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/asset/asset_edit.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
|
class AssetEditEntity extends Table with DriftDefaultsMixin {
|
||||||
|
const AssetEditEntity();
|
||||||
|
|
||||||
|
TextColumn get id => text()();
|
||||||
|
|
||||||
|
TextColumn get assetId => text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
IntColumn get action => intEnum<AssetEditAction>()();
|
||||||
|
|
||||||
|
BlobColumn get parameters => blob().map(editParameterConverter)();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column> get primaryKey => {id};
|
||||||
|
}
|
||||||
|
|
||||||
|
final JsonTypeConverter2<Map<String, Object?>, Uint8List, Object?> editParameterConverter = TypeConverter.jsonb(
|
||||||
|
fromJson: (json) => json as Map<String, Object?>,
|
||||||
|
);
|
||||||
@@ -0,0 +1,678 @@
|
|||||||
|
// dart format width=80
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:drift/drift.dart' as i0;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.dart'
|
||||||
|
as i1;
|
||||||
|
import 'package:immich_mobile/domain/models/asset/asset_edit.model.dart' as i2;
|
||||||
|
import 'dart:typed_data' as i3;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.dart'
|
||||||
|
as i4;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart'
|
||||||
|
as i5;
|
||||||
|
import 'package:drift/internal/modular.dart' as i6;
|
||||||
|
|
||||||
|
typedef $$AssetEditEntityTableCreateCompanionBuilder =
|
||||||
|
i1.AssetEditEntityCompanion Function({
|
||||||
|
required String id,
|
||||||
|
required String assetId,
|
||||||
|
required i2.AssetEditAction action,
|
||||||
|
required Map<String, Object?> parameters,
|
||||||
|
});
|
||||||
|
typedef $$AssetEditEntityTableUpdateCompanionBuilder =
|
||||||
|
i1.AssetEditEntityCompanion Function({
|
||||||
|
i0.Value<String> id,
|
||||||
|
i0.Value<String> assetId,
|
||||||
|
i0.Value<i2.AssetEditAction> action,
|
||||||
|
i0.Value<Map<String, Object?>> parameters,
|
||||||
|
});
|
||||||
|
|
||||||
|
final class $$AssetEditEntityTableReferences
|
||||||
|
extends
|
||||||
|
i0.BaseReferences<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$AssetEditEntityTable,
|
||||||
|
i1.AssetEditEntityData
|
||||||
|
> {
|
||||||
|
$$AssetEditEntityTableReferences(
|
||||||
|
super.$_db,
|
||||||
|
super.$_table,
|
||||||
|
super.$_typedResult,
|
||||||
|
);
|
||||||
|
|
||||||
|
static i5.$RemoteAssetEntityTable _assetIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity')
|
||||||
|
.createAlias(
|
||||||
|
i0.$_aliasNameGenerator(
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$AssetEditEntityTable>('asset_edit_entity')
|
||||||
|
.assetId,
|
||||||
|
i6.ReadDatabaseContainer(
|
||||||
|
db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity').id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
i5.$$RemoteAssetEntityTableProcessedTableManager get assetId {
|
||||||
|
final $_column = $_itemColumn<String>('asset_id')!;
|
||||||
|
|
||||||
|
final manager = i5
|
||||||
|
.$$RemoteAssetEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i6.ReadDatabaseContainer(
|
||||||
|
$_db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
)
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_assetIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AssetEditEntityTableFilterComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AssetEditEntityTable> {
|
||||||
|
$$AssetEditEntityTableFilterComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnFilters<String> get id => $composableBuilder(
|
||||||
|
column: $table.id,
|
||||||
|
builder: (column) => i0.ColumnFilters(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i0.ColumnWithTypeConverterFilters<i2.AssetEditAction, i2.AssetEditAction, int>
|
||||||
|
get action => $composableBuilder(
|
||||||
|
column: $table.action,
|
||||||
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i0.ColumnWithTypeConverterFilters<
|
||||||
|
Map<String, Object?>,
|
||||||
|
Map<String, Object>,
|
||||||
|
i3.Uint8List
|
||||||
|
>
|
||||||
|
get parameters => $composableBuilder(
|
||||||
|
column: $table.parameters,
|
||||||
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i5.$$RemoteAssetEntityTableFilterComposer get assetId {
|
||||||
|
final i5.$$RemoteAssetEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder:
|
||||||
|
(
|
||||||
|
joinBuilder, {
|
||||||
|
$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
}) => i5.$$RemoteAssetEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AssetEditEntityTableOrderingComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AssetEditEntityTable> {
|
||||||
|
$$AssetEditEntityTableOrderingComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnOrderings<String> get id => $composableBuilder(
|
||||||
|
column: $table.id,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i0.ColumnOrderings<int> get action => $composableBuilder(
|
||||||
|
column: $table.action,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i0.ColumnOrderings<i3.Uint8List> get parameters => $composableBuilder(
|
||||||
|
column: $table.parameters,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column),
|
||||||
|
);
|
||||||
|
|
||||||
|
i5.$$RemoteAssetEntityTableOrderingComposer get assetId {
|
||||||
|
final i5.$$RemoteAssetEntityTableOrderingComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder:
|
||||||
|
(
|
||||||
|
joinBuilder, {
|
||||||
|
$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
}) => i5.$$RemoteAssetEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AssetEditEntityTableAnnotationComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$AssetEditEntityTable> {
|
||||||
|
$$AssetEditEntityTableAnnotationComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.GeneratedColumn<String> get id =>
|
||||||
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumnWithTypeConverter<i2.AssetEditAction, int> get action =>
|
||||||
|
$composableBuilder(column: $table.action, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumnWithTypeConverter<Map<String, Object?>, i3.Uint8List>
|
||||||
|
get parameters => $composableBuilder(
|
||||||
|
column: $table.parameters,
|
||||||
|
builder: (column) => column,
|
||||||
|
);
|
||||||
|
|
||||||
|
i5.$$RemoteAssetEntityTableAnnotationComposer get assetId {
|
||||||
|
final i5.$$RemoteAssetEntityTableAnnotationComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder:
|
||||||
|
(
|
||||||
|
joinBuilder, {
|
||||||
|
$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
}) => i5.$$RemoteAssetEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer(
|
||||||
|
$db,
|
||||||
|
).resultSet<i5.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$AssetEditEntityTableTableManager
|
||||||
|
extends
|
||||||
|
i0.RootTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$AssetEditEntityTable,
|
||||||
|
i1.AssetEditEntityData,
|
||||||
|
i1.$$AssetEditEntityTableFilterComposer,
|
||||||
|
i1.$$AssetEditEntityTableOrderingComposer,
|
||||||
|
i1.$$AssetEditEntityTableAnnotationComposer,
|
||||||
|
$$AssetEditEntityTableCreateCompanionBuilder,
|
||||||
|
$$AssetEditEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.AssetEditEntityData, i1.$$AssetEditEntityTableReferences),
|
||||||
|
i1.AssetEditEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool assetId})
|
||||||
|
> {
|
||||||
|
$$AssetEditEntityTableTableManager(
|
||||||
|
i0.GeneratedDatabase db,
|
||||||
|
i1.$AssetEditEntityTable table,
|
||||||
|
) : super(
|
||||||
|
i0.TableManagerState(
|
||||||
|
db: db,
|
||||||
|
table: table,
|
||||||
|
createFilteringComposer: () =>
|
||||||
|
i1.$$AssetEditEntityTableFilterComposer($db: db, $table: table),
|
||||||
|
createOrderingComposer: () =>
|
||||||
|
i1.$$AssetEditEntityTableOrderingComposer($db: db, $table: table),
|
||||||
|
createComputedFieldComposer: () => i1
|
||||||
|
.$$AssetEditEntityTableAnnotationComposer($db: db, $table: table),
|
||||||
|
updateCompanionCallback:
|
||||||
|
({
|
||||||
|
i0.Value<String> id = const i0.Value.absent(),
|
||||||
|
i0.Value<String> assetId = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AssetEditAction> action = const i0.Value.absent(),
|
||||||
|
i0.Value<Map<String, Object?>> parameters =
|
||||||
|
const i0.Value.absent(),
|
||||||
|
}) => i1.AssetEditEntityCompanion(
|
||||||
|
id: id,
|
||||||
|
assetId: assetId,
|
||||||
|
action: action,
|
||||||
|
parameters: parameters,
|
||||||
|
),
|
||||||
|
createCompanionCallback:
|
||||||
|
({
|
||||||
|
required String id,
|
||||||
|
required String assetId,
|
||||||
|
required i2.AssetEditAction action,
|
||||||
|
required Map<String, Object?> parameters,
|
||||||
|
}) => i1.AssetEditEntityCompanion.insert(
|
||||||
|
id: id,
|
||||||
|
assetId: assetId,
|
||||||
|
action: action,
|
||||||
|
parameters: parameters,
|
||||||
|
),
|
||||||
|
withReferenceMapper: (p0) => p0
|
||||||
|
.map(
|
||||||
|
(e) => (
|
||||||
|
e.readTable(table),
|
||||||
|
i1.$$AssetEditEntityTableReferences(db, table, e),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
prefetchHooksCallback: ({assetId = false}) {
|
||||||
|
return i0.PrefetchHooks(
|
||||||
|
db: db,
|
||||||
|
explicitlyWatchedTables: [],
|
||||||
|
addJoins:
|
||||||
|
<
|
||||||
|
T extends i0.TableManagerState<
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic,
|
||||||
|
dynamic
|
||||||
|
>
|
||||||
|
>(state) {
|
||||||
|
if (assetId) {
|
||||||
|
state =
|
||||||
|
state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.assetId,
|
||||||
|
referencedTable: i1
|
||||||
|
.$$AssetEditEntityTableReferences
|
||||||
|
._assetIdTable(db),
|
||||||
|
referencedColumn: i1
|
||||||
|
.$$AssetEditEntityTableReferences
|
||||||
|
._assetIdTable(db)
|
||||||
|
.id,
|
||||||
|
)
|
||||||
|
as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
getPrefetchedDataCallback: (items) async {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef $$AssetEditEntityTableProcessedTableManager =
|
||||||
|
i0.ProcessedTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$AssetEditEntityTable,
|
||||||
|
i1.AssetEditEntityData,
|
||||||
|
i1.$$AssetEditEntityTableFilterComposer,
|
||||||
|
i1.$$AssetEditEntityTableOrderingComposer,
|
||||||
|
i1.$$AssetEditEntityTableAnnotationComposer,
|
||||||
|
$$AssetEditEntityTableCreateCompanionBuilder,
|
||||||
|
$$AssetEditEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.AssetEditEntityData, i1.$$AssetEditEntityTableReferences),
|
||||||
|
i1.AssetEditEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool assetId})
|
||||||
|
>;
|
||||||
|
|
||||||
|
class $AssetEditEntityTable extends i4.AssetEditEntity
|
||||||
|
with i0.TableInfo<$AssetEditEntityTable, i1.AssetEditEntityData> {
|
||||||
|
@override
|
||||||
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
$AssetEditEntityTable(this.attachedDatabase, [this._alias]);
|
||||||
|
static const i0.VerificationMeta _idMeta = const i0.VerificationMeta('id');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> id = i0.GeneratedColumn<String>(
|
||||||
|
'id',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
);
|
||||||
|
static const i0.VerificationMeta _assetIdMeta = const i0.VerificationMeta(
|
||||||
|
'assetId',
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> assetId = i0.GeneratedColumn<String>(
|
||||||
|
'asset_id',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES remote_asset_entity (id) ON DELETE CASCADE',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumnWithTypeConverter<i2.AssetEditAction, int>
|
||||||
|
action =
|
||||||
|
i0.GeneratedColumn<int>(
|
||||||
|
'action',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i0.DriftSqlType.int,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
).withConverter<i2.AssetEditAction>(
|
||||||
|
i1.$AssetEditEntityTable.$converteraction,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumnWithTypeConverter<
|
||||||
|
Map<String, Object?>,
|
||||||
|
i3.Uint8List
|
||||||
|
>
|
||||||
|
parameters =
|
||||||
|
i0.GeneratedColumn<i3.Uint8List>(
|
||||||
|
'parameters',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i0.DriftSqlType.blob,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
).withConverter<Map<String, Object?>>(
|
||||||
|
i1.$AssetEditEntityTable.$converterparameters,
|
||||||
|
);
|
||||||
|
@override
|
||||||
|
List<i0.GeneratedColumn> get $columns => [id, assetId, action, parameters];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
|
@override
|
||||||
|
String get actualTableName => $name;
|
||||||
|
static const String $name = 'asset_edit_entity';
|
||||||
|
@override
|
||||||
|
i0.VerificationContext validateIntegrity(
|
||||||
|
i0.Insertable<i1.AssetEditEntityData> instance, {
|
||||||
|
bool isInserting = false,
|
||||||
|
}) {
|
||||||
|
final context = i0.VerificationContext();
|
||||||
|
final data = instance.toColumns(true);
|
||||||
|
if (data.containsKey('id')) {
|
||||||
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_idMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('asset_id')) {
|
||||||
|
context.handle(
|
||||||
|
_assetIdMeta,
|
||||||
|
assetId.isAcceptableOrUnknown(data['asset_id']!, _assetIdMeta),
|
||||||
|
);
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_assetIdMeta);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<i0.GeneratedColumn> get $primaryKey => {id};
|
||||||
|
@override
|
||||||
|
i1.AssetEditEntityData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return i1.AssetEditEntityData(
|
||||||
|
id: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.string,
|
||||||
|
data['${effectivePrefix}id'],
|
||||||
|
)!,
|
||||||
|
assetId: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.string,
|
||||||
|
data['${effectivePrefix}asset_id'],
|
||||||
|
)!,
|
||||||
|
action: i1.$AssetEditEntityTable.$converteraction.fromSql(
|
||||||
|
attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.int,
|
||||||
|
data['${effectivePrefix}action'],
|
||||||
|
)!,
|
||||||
|
),
|
||||||
|
parameters: i1.$AssetEditEntityTable.$converterparameters.fromSql(
|
||||||
|
attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.blob,
|
||||||
|
data['${effectivePrefix}parameters'],
|
||||||
|
)!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
$AssetEditEntityTable createAlias(String alias) {
|
||||||
|
return $AssetEditEntityTable(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
static i0.JsonTypeConverter2<i2.AssetEditAction, int, int> $converteraction =
|
||||||
|
const i0.EnumIndexConverter<i2.AssetEditAction>(
|
||||||
|
i2.AssetEditAction.values,
|
||||||
|
);
|
||||||
|
static i0.JsonTypeConverter2<Map<String, Object?>, i3.Uint8List, Object?>
|
||||||
|
$converterparameters = i4.editParameterConverter;
|
||||||
|
@override
|
||||||
|
bool get withoutRowId => true;
|
||||||
|
@override
|
||||||
|
bool get isStrict => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AssetEditEntityData extends i0.DataClass
|
||||||
|
implements i0.Insertable<i1.AssetEditEntityData> {
|
||||||
|
final String id;
|
||||||
|
final String assetId;
|
||||||
|
final i2.AssetEditAction action;
|
||||||
|
final Map<String, Object?> parameters;
|
||||||
|
const AssetEditEntityData({
|
||||||
|
required this.id,
|
||||||
|
required this.assetId,
|
||||||
|
required this.action,
|
||||||
|
required this.parameters,
|
||||||
|
});
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
map['id'] = i0.Variable<String>(id);
|
||||||
|
map['asset_id'] = i0.Variable<String>(assetId);
|
||||||
|
{
|
||||||
|
map['action'] = i0.Variable<int>(
|
||||||
|
i1.$AssetEditEntityTable.$converteraction.toSql(action),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
map['parameters'] = i0.Variable<i3.Uint8List>(
|
||||||
|
i1.$AssetEditEntityTable.$converterparameters.toSql(parameters),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory AssetEditEntityData.fromJson(
|
||||||
|
Map<String, dynamic> json, {
|
||||||
|
i0.ValueSerializer? serializer,
|
||||||
|
}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return AssetEditEntityData(
|
||||||
|
id: serializer.fromJson<String>(json['id']),
|
||||||
|
assetId: serializer.fromJson<String>(json['assetId']),
|
||||||
|
action: i1.$AssetEditEntityTable.$converteraction.fromJson(
|
||||||
|
serializer.fromJson<int>(json['action']),
|
||||||
|
),
|
||||||
|
parameters: i1.$AssetEditEntityTable.$converterparameters.fromJson(
|
||||||
|
serializer.fromJson<Object?>(json['parameters']),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'id': serializer.toJson<String>(id),
|
||||||
|
'assetId': serializer.toJson<String>(assetId),
|
||||||
|
'action': serializer.toJson<int>(
|
||||||
|
i1.$AssetEditEntityTable.$converteraction.toJson(action),
|
||||||
|
),
|
||||||
|
'parameters': serializer.toJson<Object?>(
|
||||||
|
i1.$AssetEditEntityTable.$converterparameters.toJson(parameters),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.AssetEditEntityData copyWith({
|
||||||
|
String? id,
|
||||||
|
String? assetId,
|
||||||
|
i2.AssetEditAction? action,
|
||||||
|
Map<String, Object?>? parameters,
|
||||||
|
}) => i1.AssetEditEntityData(
|
||||||
|
id: id ?? this.id,
|
||||||
|
assetId: assetId ?? this.assetId,
|
||||||
|
action: action ?? this.action,
|
||||||
|
parameters: parameters ?? this.parameters,
|
||||||
|
);
|
||||||
|
AssetEditEntityData copyWithCompanion(i1.AssetEditEntityCompanion data) {
|
||||||
|
return AssetEditEntityData(
|
||||||
|
id: data.id.present ? data.id.value : this.id,
|
||||||
|
assetId: data.assetId.present ? data.assetId.value : this.assetId,
|
||||||
|
action: data.action.present ? data.action.value : this.action,
|
||||||
|
parameters: data.parameters.present
|
||||||
|
? data.parameters.value
|
||||||
|
: this.parameters,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('AssetEditEntityData(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('assetId: $assetId, ')
|
||||||
|
..write('action: $action, ')
|
||||||
|
..write('parameters: $parameters')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(id, assetId, action, parameters);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is i1.AssetEditEntityData &&
|
||||||
|
other.id == this.id &&
|
||||||
|
other.assetId == this.assetId &&
|
||||||
|
other.action == this.action &&
|
||||||
|
other.parameters == this.parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
class AssetEditEntityCompanion
|
||||||
|
extends i0.UpdateCompanion<i1.AssetEditEntityData> {
|
||||||
|
final i0.Value<String> id;
|
||||||
|
final i0.Value<String> assetId;
|
||||||
|
final i0.Value<i2.AssetEditAction> action;
|
||||||
|
final i0.Value<Map<String, Object?>> parameters;
|
||||||
|
const AssetEditEntityCompanion({
|
||||||
|
this.id = const i0.Value.absent(),
|
||||||
|
this.assetId = const i0.Value.absent(),
|
||||||
|
this.action = const i0.Value.absent(),
|
||||||
|
this.parameters = const i0.Value.absent(),
|
||||||
|
});
|
||||||
|
AssetEditEntityCompanion.insert({
|
||||||
|
required String id,
|
||||||
|
required String assetId,
|
||||||
|
required i2.AssetEditAction action,
|
||||||
|
required Map<String, Object?> parameters,
|
||||||
|
}) : id = i0.Value(id),
|
||||||
|
assetId = i0.Value(assetId),
|
||||||
|
action = i0.Value(action),
|
||||||
|
parameters = i0.Value(parameters);
|
||||||
|
static i0.Insertable<i1.AssetEditEntityData> custom({
|
||||||
|
i0.Expression<String>? id,
|
||||||
|
i0.Expression<String>? assetId,
|
||||||
|
i0.Expression<int>? action,
|
||||||
|
i0.Expression<i3.Uint8List>? parameters,
|
||||||
|
}) {
|
||||||
|
return i0.RawValuesInsertable({
|
||||||
|
if (id != null) 'id': id,
|
||||||
|
if (assetId != null) 'asset_id': assetId,
|
||||||
|
if (action != null) 'action': action,
|
||||||
|
if (parameters != null) 'parameters': parameters,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.AssetEditEntityCompanion copyWith({
|
||||||
|
i0.Value<String>? id,
|
||||||
|
i0.Value<String>? assetId,
|
||||||
|
i0.Value<i2.AssetEditAction>? action,
|
||||||
|
i0.Value<Map<String, Object?>>? parameters,
|
||||||
|
}) {
|
||||||
|
return i1.AssetEditEntityCompanion(
|
||||||
|
id: id ?? this.id,
|
||||||
|
assetId: assetId ?? this.assetId,
|
||||||
|
action: action ?? this.action,
|
||||||
|
parameters: parameters ?? this.parameters,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
if (id.present) {
|
||||||
|
map['id'] = i0.Variable<String>(id.value);
|
||||||
|
}
|
||||||
|
if (assetId.present) {
|
||||||
|
map['asset_id'] = i0.Variable<String>(assetId.value);
|
||||||
|
}
|
||||||
|
if (action.present) {
|
||||||
|
map['action'] = i0.Variable<int>(
|
||||||
|
i1.$AssetEditEntityTable.$converteraction.toSql(action.value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (parameters.present) {
|
||||||
|
map['parameters'] = i0.Variable<i3.Uint8List>(
|
||||||
|
i1.$AssetEditEntityTable.$converterparameters.toSql(parameters.value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('AssetEditEntityCompanion(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('assetId: $assetId, ')
|
||||||
|
..write('action: $action, ')
|
||||||
|
..write('parameters: $parameters')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ class LocalAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension LocalAssetEntityDataDomainExtension on LocalAssetEntityData {
|
extension LocalAssetEntityDataDomainExtension on LocalAssetEntityData {
|
||||||
LocalAsset toDto({String? remoteId}) => LocalAsset(
|
LocalAsset toDto({required bool isEdited, String? remoteId}) => LocalAsset(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
checksum: checksum,
|
checksum: checksum,
|
||||||
@@ -47,5 +47,6 @@ extension LocalAssetEntityDataDomainExtension on LocalAssetEntityData {
|
|||||||
latitude: latitude,
|
latitude: latitude,
|
||||||
longitude: longitude,
|
longitude: longitude,
|
||||||
cloudId: iCloudId,
|
cloudId: iCloudId,
|
||||||
|
isEdited: isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'stack.entity.dart';
|
|||||||
import 'local_asset.entity.dart';
|
import 'local_asset.entity.dart';
|
||||||
import 'local_album.entity.dart';
|
import 'local_album.entity.dart';
|
||||||
import 'local_album_asset.entity.dart';
|
import 'local_album_asset.entity.dart';
|
||||||
|
import 'asset_edit.entity.dart';
|
||||||
|
|
||||||
mergedAsset:
|
mergedAsset:
|
||||||
SELECT
|
SELECT
|
||||||
@@ -25,7 +26,8 @@ SELECT
|
|||||||
NULL as i_cloud_id,
|
NULL as i_cloud_id,
|
||||||
NULL as latitude,
|
NULL as latitude,
|
||||||
NULL as longitude,
|
NULL as longitude,
|
||||||
NULL as adjustmentTime
|
NULL as adjustmentTime,
|
||||||
|
CASE WHEN EXISTS (SELECT 1 FROM asset_edit_entity aee WHERE aee.asset_id = rae.id) THEN 1 ELSE 0 END as is_edited
|
||||||
FROM
|
FROM
|
||||||
remote_asset_entity rae
|
remote_asset_entity rae
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
@@ -61,7 +63,8 @@ SELECT
|
|||||||
lae.i_cloud_id,
|
lae.i_cloud_id,
|
||||||
lae.latitude,
|
lae.latitude,
|
||||||
lae.longitude,
|
lae.longitude,
|
||||||
lae.adjustment_time
|
lae.adjustment_time,
|
||||||
|
0 as is_edited
|
||||||
FROM
|
FROM
|
||||||
local_asset_entity lae
|
local_asset_entity lae
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
|
|||||||
+16
-7
@@ -9,10 +9,12 @@ import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.
|
|||||||
as i4;
|
as i4;
|
||||||
import 'package:immich_mobile/infrastructure/entities/stack.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/stack.entity.drift.dart'
|
||||||
as i5;
|
as i5;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.dart'
|
||||||
as i6;
|
as i6;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
||||||
as i7;
|
as i7;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
||||||
|
as i8;
|
||||||
|
|
||||||
class MergedAssetDrift extends i1.ModularAccessor {
|
class MergedAssetDrift extends i1.ModularAccessor {
|
||||||
MergedAssetDrift(i0.GeneratedDatabase db) : super(db);
|
MergedAssetDrift(i0.GeneratedDatabase db) : super(db);
|
||||||
@@ -29,7 +31,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
|||||||
);
|
);
|
||||||
$arrayStartIndex += generatedlimit.amountOfVariables;
|
$arrayStartIndex += generatedlimit.amountOfVariables;
|
||||||
return customSelect(
|
return customSelect(
|
||||||
'SELECT rae.id AS remote_id, (SELECT lae.id FROM local_asset_entity AS lae WHERE lae.checksum = rae.checksum LIMIT 1) AS local_id, rae.name, rae.type, rae.created_at AS created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, rae.live_photo_video_id, 0 AS orientation, rae.stack_id, NULL AS i_cloud_id, NULL AS latitude, NULL AS longitude, NULL AS adjustmentTime FROM remote_asset_entity AS rae LEFT JOIN stack_entity AS se ON rae.stack_id = se.id WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandeduserIds) AND(rae.stack_id IS NULL OR rae.id = se.primary_asset_id)UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at AS created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, NULL AS live_photo_video_id, lae.orientation, NULL AS stack_id, lae.i_cloud_id, lae.latitude, lae.longitude, lae.adjustment_time FROM local_asset_entity AS lae WHERE NOT EXISTS (SELECT 1 FROM remote_asset_entity AS rae WHERE rae.checksum = lae.checksum AND rae.owner_id IN ($expandeduserIds)) AND EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 0) AND NOT EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 2) ORDER BY created_at DESC ${generatedlimit.sql}',
|
'SELECT rae.id AS remote_id, (SELECT lae.id FROM local_asset_entity AS lae WHERE lae.checksum = rae.checksum LIMIT 1) AS local_id, rae.name, rae.type, rae.created_at AS created_at, rae.updated_at, rae.width, rae.height, rae.duration_in_seconds, rae.is_favorite, rae.thumb_hash, rae.checksum, rae.owner_id, rae.live_photo_video_id, 0 AS orientation, rae.stack_id, NULL AS i_cloud_id, NULL AS latitude, NULL AS longitude, NULL AS adjustmentTime, CASE WHEN EXISTS (SELECT 1 AS _c0 FROM asset_edit_entity AS aee WHERE aee.asset_id = rae.id) THEN 1 ELSE 0 END AS is_edited FROM remote_asset_entity AS rae LEFT JOIN stack_entity AS se ON rae.stack_id = se.id WHERE rae.deleted_at IS NULL AND rae.visibility = 0 AND rae.owner_id IN ($expandeduserIds) AND(rae.stack_id IS NULL OR rae.id = se.primary_asset_id)UNION ALL SELECT NULL AS remote_id, lae.id AS local_id, lae.name, lae.type, lae.created_at AS created_at, lae.updated_at, lae.width, lae.height, lae.duration_in_seconds, lae.is_favorite, NULL AS thumb_hash, lae.checksum, NULL AS owner_id, NULL AS live_photo_video_id, lae.orientation, NULL AS stack_id, lae.i_cloud_id, lae.latitude, lae.longitude, lae.adjustment_time, 0 AS is_edited FROM local_asset_entity AS lae WHERE NOT EXISTS (SELECT 1 FROM remote_asset_entity AS rae WHERE rae.checksum = lae.checksum AND rae.owner_id IN ($expandeduserIds)) AND EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 0) AND NOT EXISTS (SELECT 1 FROM local_album_asset_entity AS laa INNER JOIN local_album_entity AS la ON laa.album_id = la.id WHERE laa.asset_id = lae.id AND la.backup_selection = 2) ORDER BY created_at DESC ${generatedlimit.sql}',
|
||||||
variables: [
|
variables: [
|
||||||
for (var $ in userIds) i0.Variable<String>($),
|
for (var $ in userIds) i0.Variable<String>($),
|
||||||
...generatedlimit.introducedVariables,
|
...generatedlimit.introducedVariables,
|
||||||
@@ -37,6 +39,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
|||||||
readsFrom: {
|
readsFrom: {
|
||||||
remoteAssetEntity,
|
remoteAssetEntity,
|
||||||
localAssetEntity,
|
localAssetEntity,
|
||||||
|
assetEditEntity,
|
||||||
stackEntity,
|
stackEntity,
|
||||||
localAlbumAssetEntity,
|
localAlbumAssetEntity,
|
||||||
localAlbumEntity,
|
localAlbumEntity,
|
||||||
@@ -66,6 +69,7 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
|||||||
latitude: row.readNullable<double>('latitude'),
|
latitude: row.readNullable<double>('latitude'),
|
||||||
longitude: row.readNullable<double>('longitude'),
|
longitude: row.readNullable<double>('longitude'),
|
||||||
adjustmentTime: row.readNullable<DateTime>('adjustmentTime'),
|
adjustmentTime: row.readNullable<DateTime>('adjustmentTime'),
|
||||||
|
isEdited: row.read<int>('is_edited'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -107,13 +111,16 @@ class MergedAssetDrift extends i1.ModularAccessor {
|
|||||||
i3.$LocalAssetEntityTable get localAssetEntity => i1.ReadDatabaseContainer(
|
i3.$LocalAssetEntityTable get localAssetEntity => i1.ReadDatabaseContainer(
|
||||||
attachedDatabase,
|
attachedDatabase,
|
||||||
).resultSet<i3.$LocalAssetEntityTable>('local_asset_entity');
|
).resultSet<i3.$LocalAssetEntityTable>('local_asset_entity');
|
||||||
i6.$LocalAlbumAssetEntityTable get localAlbumAssetEntity =>
|
i6.$AssetEditEntityTable get assetEditEntity => i1.ReadDatabaseContainer(
|
||||||
|
attachedDatabase,
|
||||||
|
).resultSet<i6.$AssetEditEntityTable>('asset_edit_entity');
|
||||||
|
i7.$LocalAlbumAssetEntityTable get localAlbumAssetEntity =>
|
||||||
i1.ReadDatabaseContainer(
|
i1.ReadDatabaseContainer(
|
||||||
attachedDatabase,
|
attachedDatabase,
|
||||||
).resultSet<i6.$LocalAlbumAssetEntityTable>('local_album_asset_entity');
|
).resultSet<i7.$LocalAlbumAssetEntityTable>('local_album_asset_entity');
|
||||||
i7.$LocalAlbumEntityTable get localAlbumEntity => i1.ReadDatabaseContainer(
|
i8.$LocalAlbumEntityTable get localAlbumEntity => i1.ReadDatabaseContainer(
|
||||||
attachedDatabase,
|
attachedDatabase,
|
||||||
).resultSet<i7.$LocalAlbumEntityTable>('local_album_entity');
|
).resultSet<i8.$LocalAlbumEntityTable>('local_album_entity');
|
||||||
}
|
}
|
||||||
|
|
||||||
class MergedAssetResult {
|
class MergedAssetResult {
|
||||||
@@ -137,6 +144,7 @@ class MergedAssetResult {
|
|||||||
final double? latitude;
|
final double? latitude;
|
||||||
final double? longitude;
|
final double? longitude;
|
||||||
final DateTime? adjustmentTime;
|
final DateTime? adjustmentTime;
|
||||||
|
final int isEdited;
|
||||||
MergedAssetResult({
|
MergedAssetResult({
|
||||||
this.remoteId,
|
this.remoteId,
|
||||||
this.localId,
|
this.localId,
|
||||||
@@ -158,6 +166,7 @@ class MergedAssetResult {
|
|||||||
this.latitude,
|
this.latitude,
|
||||||
this.longitude,
|
this.longitude,
|
||||||
this.adjustmentTime,
|
this.adjustmentTime,
|
||||||
|
required this.isEdited,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class RemoteAssetEntity extends Table with DriftDefaultsMixin, AssetEntityMixin
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
||||||
RemoteAsset toDto({String? localId}) => RemoteAsset(
|
RemoteAsset toDto({required bool isEdited, String? localId}) => RemoteAsset(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
ownerId: ownerId,
|
ownerId: ownerId,
|
||||||
@@ -66,5 +66,6 @@ extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
|||||||
livePhotoVideoId: livePhotoVideoId,
|
livePhotoVideoId: livePhotoVideoId,
|
||||||
localId: localId,
|
localId: localId,
|
||||||
stackId: stackId,
|
stackId: stackId,
|
||||||
|
isEdited: isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,5 +45,6 @@ extension TrashedLocalAssetEntityDataDomainExtension on TrashedLocalAssetEntityD
|
|||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
orientation: orientation,
|
orientation: orientation,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,16 @@ class DriftBackupRepository extends DriftDatabaseRepository {
|
|||||||
query.where((lae) => lae.checksum.isNotNull());
|
query.where((lae) => lae.checksum.isNotNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
return query.map((localAsset) => localAsset.toDto()).get();
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
final assetsQuery = query.join([
|
||||||
|
leftOuterJoin(_db.remoteAssetEntity, _db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum)),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])..addColumns([hasEdits]);
|
||||||
|
|
||||||
|
return assetsQuery.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!)).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:drift/drift.dart';
|
|||||||
import 'package:drift_flutter/drift_flutter.dart';
|
import 'package:drift_flutter/drift_flutter.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:immich_mobile/domain/interfaces/db.interface.dart';
|
import 'package:immich_mobile/domain/interfaces/db.interface.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
|
||||||
@@ -66,6 +67,7 @@ class IsarDatabaseRepository implements IDatabaseRepository {
|
|||||||
AssetFaceEntity,
|
AssetFaceEntity,
|
||||||
StoreEntity,
|
StoreEntity,
|
||||||
TrashedLocalAssetEntity,
|
TrashedLocalAssetEntity,
|
||||||
|
AssetEditEntity,
|
||||||
],
|
],
|
||||||
include: {'package:immich_mobile/infrastructure/entities/merged_asset.drift'},
|
include: {'package:immich_mobile/infrastructure/entities/merged_asset.drift'},
|
||||||
)
|
)
|
||||||
@@ -97,7 +99,7 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 16;
|
int get schemaVersion => 17;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MigrationStrategy get migration => MigrationStrategy(
|
MigrationStrategy get migration => MigrationStrategy(
|
||||||
@@ -201,6 +203,9 @@ class Drift extends $Drift implements IDatabaseRepository {
|
|||||||
await m.createIndex(v16.idxLocalAssetCloudId);
|
await m.createIndex(v16.idxLocalAssetCloudId);
|
||||||
await m.createTable(v16.remoteAssetCloudIdEntity);
|
await m.createTable(v16.remoteAssetCloudIdEntity);
|
||||||
},
|
},
|
||||||
|
from16To17: (m, v17) async {
|
||||||
|
await m.createTable(v17.assetEditEntity);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+83
-69
@@ -9,41 +9,43 @@ import 'package:immich_mobile/infrastructure/entities/stack.entity.drift.dart'
|
|||||||
as i3;
|
as i3;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart'
|
||||||
as i4;
|
as i4;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.dart'
|
||||||
as i5;
|
as i5;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
as i6;
|
as i6;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
||||||
as i7;
|
as i7;
|
||||||
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart'
|
||||||
as i8;
|
as i8;
|
||||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart'
|
||||||
as i9;
|
as i9;
|
||||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift.dart'
|
||||||
as i10;
|
as i10;
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart'
|
||||||
as i11;
|
as i11;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
||||||
as i12;
|
as i12;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
||||||
as i13;
|
as i13;
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset_cloud_id.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
||||||
as i14;
|
as i14;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_asset_cloud_id.entity.drift.dart'
|
||||||
as i15;
|
as i15;
|
||||||
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory.entity.drift.dart'
|
||||||
as i16;
|
as i16;
|
||||||
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/memory_asset.entity.drift.dart'
|
||||||
as i17;
|
as i17;
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/person.entity.drift.dart'
|
||||||
as i18;
|
as i18;
|
||||||
import 'package:immich_mobile/infrastructure/entities/store.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart'
|
||||||
as i19;
|
as i19;
|
||||||
import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/store.entity.drift.dart'
|
||||||
as i20;
|
as i20;
|
||||||
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/trashed_local_asset.entity.drift.dart'
|
||||||
as i21;
|
as i21;
|
||||||
import 'package:drift/internal/modular.dart' as i22;
|
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
||||||
|
as i22;
|
||||||
|
import 'package:drift/internal/modular.dart' as i23;
|
||||||
|
|
||||||
abstract class $Drift extends i0.GeneratedDatabase {
|
abstract class $Drift extends i0.GeneratedDatabase {
|
||||||
$Drift(i0.QueryExecutor e) : super(e);
|
$Drift(i0.QueryExecutor e) : super(e);
|
||||||
@@ -54,40 +56,42 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
late final i3.$StackEntityTable stackEntity = i3.$StackEntityTable(this);
|
late final i3.$StackEntityTable stackEntity = i3.$StackEntityTable(this);
|
||||||
late final i4.$LocalAssetEntityTable localAssetEntity = i4
|
late final i4.$LocalAssetEntityTable localAssetEntity = i4
|
||||||
.$LocalAssetEntityTable(this);
|
.$LocalAssetEntityTable(this);
|
||||||
late final i5.$RemoteAlbumEntityTable remoteAlbumEntity = i5
|
late final i5.$AssetEditEntityTable assetEditEntity = i5
|
||||||
|
.$AssetEditEntityTable(this);
|
||||||
|
late final i6.$RemoteAlbumEntityTable remoteAlbumEntity = i6
|
||||||
.$RemoteAlbumEntityTable(this);
|
.$RemoteAlbumEntityTable(this);
|
||||||
late final i6.$LocalAlbumEntityTable localAlbumEntity = i6
|
late final i7.$LocalAlbumEntityTable localAlbumEntity = i7
|
||||||
.$LocalAlbumEntityTable(this);
|
.$LocalAlbumEntityTable(this);
|
||||||
late final i7.$LocalAlbumAssetEntityTable localAlbumAssetEntity = i7
|
late final i8.$LocalAlbumAssetEntityTable localAlbumAssetEntity = i8
|
||||||
.$LocalAlbumAssetEntityTable(this);
|
.$LocalAlbumAssetEntityTable(this);
|
||||||
late final i8.$AuthUserEntityTable authUserEntity = i8.$AuthUserEntityTable(
|
late final i9.$AuthUserEntityTable authUserEntity = i9.$AuthUserEntityTable(
|
||||||
this,
|
this,
|
||||||
);
|
);
|
||||||
late final i9.$UserMetadataEntityTable userMetadataEntity = i9
|
late final i10.$UserMetadataEntityTable userMetadataEntity = i10
|
||||||
.$UserMetadataEntityTable(this);
|
.$UserMetadataEntityTable(this);
|
||||||
late final i10.$PartnerEntityTable partnerEntity = i10.$PartnerEntityTable(
|
late final i11.$PartnerEntityTable partnerEntity = i11.$PartnerEntityTable(
|
||||||
this,
|
this,
|
||||||
);
|
);
|
||||||
late final i11.$RemoteExifEntityTable remoteExifEntity = i11
|
late final i12.$RemoteExifEntityTable remoteExifEntity = i12
|
||||||
.$RemoteExifEntityTable(this);
|
.$RemoteExifEntityTable(this);
|
||||||
late final i12.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity = i12
|
late final i13.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity = i13
|
||||||
.$RemoteAlbumAssetEntityTable(this);
|
.$RemoteAlbumAssetEntityTable(this);
|
||||||
late final i13.$RemoteAlbumUserEntityTable remoteAlbumUserEntity = i13
|
late final i14.$RemoteAlbumUserEntityTable remoteAlbumUserEntity = i14
|
||||||
.$RemoteAlbumUserEntityTable(this);
|
.$RemoteAlbumUserEntityTable(this);
|
||||||
late final i14.$RemoteAssetCloudIdEntityTable remoteAssetCloudIdEntity = i14
|
late final i15.$RemoteAssetCloudIdEntityTable remoteAssetCloudIdEntity = i15
|
||||||
.$RemoteAssetCloudIdEntityTable(this);
|
.$RemoteAssetCloudIdEntityTable(this);
|
||||||
late final i15.$MemoryEntityTable memoryEntity = i15.$MemoryEntityTable(this);
|
late final i16.$MemoryEntityTable memoryEntity = i16.$MemoryEntityTable(this);
|
||||||
late final i16.$MemoryAssetEntityTable memoryAssetEntity = i16
|
late final i17.$MemoryAssetEntityTable memoryAssetEntity = i17
|
||||||
.$MemoryAssetEntityTable(this);
|
.$MemoryAssetEntityTable(this);
|
||||||
late final i17.$PersonEntityTable personEntity = i17.$PersonEntityTable(this);
|
late final i18.$PersonEntityTable personEntity = i18.$PersonEntityTable(this);
|
||||||
late final i18.$AssetFaceEntityTable assetFaceEntity = i18
|
late final i19.$AssetFaceEntityTable assetFaceEntity = i19
|
||||||
.$AssetFaceEntityTable(this);
|
.$AssetFaceEntityTable(this);
|
||||||
late final i19.$StoreEntityTable storeEntity = i19.$StoreEntityTable(this);
|
late final i20.$StoreEntityTable storeEntity = i20.$StoreEntityTable(this);
|
||||||
late final i20.$TrashedLocalAssetEntityTable trashedLocalAssetEntity = i20
|
late final i21.$TrashedLocalAssetEntityTable trashedLocalAssetEntity = i21
|
||||||
.$TrashedLocalAssetEntityTable(this);
|
.$TrashedLocalAssetEntityTable(this);
|
||||||
i21.MergedAssetDrift get mergedAssetDrift => i22.ReadDatabaseContainer(
|
i22.MergedAssetDrift get mergedAssetDrift => i23.ReadDatabaseContainer(
|
||||||
this,
|
this,
|
||||||
).accessor<i21.MergedAssetDrift>(i21.MergedAssetDrift.new);
|
).accessor<i22.MergedAssetDrift>(i22.MergedAssetDrift.new);
|
||||||
@override
|
@override
|
||||||
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
|
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
|
||||||
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
|
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
|
||||||
@@ -97,6 +101,7 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
remoteAssetEntity,
|
remoteAssetEntity,
|
||||||
stackEntity,
|
stackEntity,
|
||||||
localAssetEntity,
|
localAssetEntity,
|
||||||
|
assetEditEntity,
|
||||||
remoteAlbumEntity,
|
remoteAlbumEntity,
|
||||||
localAlbumEntity,
|
localAlbumEntity,
|
||||||
localAlbumAssetEntity,
|
localAlbumAssetEntity,
|
||||||
@@ -119,9 +124,9 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
assetFaceEntity,
|
assetFaceEntity,
|
||||||
storeEntity,
|
storeEntity,
|
||||||
trashedLocalAssetEntity,
|
trashedLocalAssetEntity,
|
||||||
i11.idxLatLng,
|
i12.idxLatLng,
|
||||||
i20.idxTrashedLocalAssetChecksum,
|
i21.idxTrashedLocalAssetChecksum,
|
||||||
i20.idxTrashedLocalAssetAlbum,
|
i21.idxTrashedLocalAssetAlbum,
|
||||||
];
|
];
|
||||||
@override
|
@override
|
||||||
i0.StreamQueryUpdateRules
|
i0.StreamQueryUpdateRules
|
||||||
@@ -142,6 +147,13 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
),
|
),
|
||||||
result: [i0.TableUpdate('stack_entity', kind: i0.UpdateKind.delete)],
|
result: [i0.TableUpdate('stack_entity', kind: i0.UpdateKind.delete)],
|
||||||
),
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName(
|
||||||
|
'remote_asset_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete,
|
||||||
|
),
|
||||||
|
result: [i0.TableUpdate('asset_edit_entity', kind: i0.UpdateKind.delete)],
|
||||||
|
),
|
||||||
i0.WritePropagation(
|
i0.WritePropagation(
|
||||||
on: i0.TableUpdateQuery.onTableName(
|
on: i0.TableUpdateQuery.onTableName(
|
||||||
'user_entity',
|
'user_entity',
|
||||||
@@ -330,45 +342,47 @@ class $DriftManager {
|
|||||||
i3.$$StackEntityTableTableManager(_db, _db.stackEntity);
|
i3.$$StackEntityTableTableManager(_db, _db.stackEntity);
|
||||||
i4.$$LocalAssetEntityTableTableManager get localAssetEntity =>
|
i4.$$LocalAssetEntityTableTableManager get localAssetEntity =>
|
||||||
i4.$$LocalAssetEntityTableTableManager(_db, _db.localAssetEntity);
|
i4.$$LocalAssetEntityTableTableManager(_db, _db.localAssetEntity);
|
||||||
i5.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
i5.$$AssetEditEntityTableTableManager get assetEditEntity =>
|
||||||
i5.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
i5.$$AssetEditEntityTableTableManager(_db, _db.assetEditEntity);
|
||||||
i6.$$LocalAlbumEntityTableTableManager get localAlbumEntity =>
|
i6.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
||||||
i6.$$LocalAlbumEntityTableTableManager(_db, _db.localAlbumEntity);
|
i6.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
||||||
i7.$$LocalAlbumAssetEntityTableTableManager get localAlbumAssetEntity => i7
|
i7.$$LocalAlbumEntityTableTableManager get localAlbumEntity =>
|
||||||
|
i7.$$LocalAlbumEntityTableTableManager(_db, _db.localAlbumEntity);
|
||||||
|
i8.$$LocalAlbumAssetEntityTableTableManager get localAlbumAssetEntity => i8
|
||||||
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
||||||
i8.$$AuthUserEntityTableTableManager get authUserEntity =>
|
i9.$$AuthUserEntityTableTableManager get authUserEntity =>
|
||||||
i8.$$AuthUserEntityTableTableManager(_db, _db.authUserEntity);
|
i9.$$AuthUserEntityTableTableManager(_db, _db.authUserEntity);
|
||||||
i9.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
i10.$$UserMetadataEntityTableTableManager get userMetadataEntity =>
|
||||||
i9.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
i10.$$UserMetadataEntityTableTableManager(_db, _db.userMetadataEntity);
|
||||||
i10.$$PartnerEntityTableTableManager get partnerEntity =>
|
i11.$$PartnerEntityTableTableManager get partnerEntity =>
|
||||||
i10.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
i11.$$PartnerEntityTableTableManager(_db, _db.partnerEntity);
|
||||||
i11.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
i12.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
||||||
i11.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
i12.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
||||||
i12.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
i13.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
||||||
i12.$$RemoteAlbumAssetEntityTableTableManager(
|
i13.$$RemoteAlbumAssetEntityTableTableManager(
|
||||||
_db,
|
_db,
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
);
|
);
|
||||||
i13.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i13
|
i14.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i14
|
||||||
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
||||||
i14.$$RemoteAssetCloudIdEntityTableTableManager
|
i15.$$RemoteAssetCloudIdEntityTableTableManager
|
||||||
get remoteAssetCloudIdEntity =>
|
get remoteAssetCloudIdEntity =>
|
||||||
i14.$$RemoteAssetCloudIdEntityTableTableManager(
|
i15.$$RemoteAssetCloudIdEntityTableTableManager(
|
||||||
_db,
|
_db,
|
||||||
_db.remoteAssetCloudIdEntity,
|
_db.remoteAssetCloudIdEntity,
|
||||||
);
|
);
|
||||||
i15.$$MemoryEntityTableTableManager get memoryEntity =>
|
i16.$$MemoryEntityTableTableManager get memoryEntity =>
|
||||||
i15.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
i16.$$MemoryEntityTableTableManager(_db, _db.memoryEntity);
|
||||||
i16.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
i17.$$MemoryAssetEntityTableTableManager get memoryAssetEntity =>
|
||||||
i16.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
i17.$$MemoryAssetEntityTableTableManager(_db, _db.memoryAssetEntity);
|
||||||
i17.$$PersonEntityTableTableManager get personEntity =>
|
i18.$$PersonEntityTableTableManager get personEntity =>
|
||||||
i17.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
i18.$$PersonEntityTableTableManager(_db, _db.personEntity);
|
||||||
i18.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
i19.$$AssetFaceEntityTableTableManager get assetFaceEntity =>
|
||||||
i18.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
i19.$$AssetFaceEntityTableTableManager(_db, _db.assetFaceEntity);
|
||||||
i19.$$StoreEntityTableTableManager get storeEntity =>
|
i20.$$StoreEntityTableTableManager get storeEntity =>
|
||||||
i19.$$StoreEntityTableTableManager(_db, _db.storeEntity);
|
i20.$$StoreEntityTableTableManager(_db, _db.storeEntity);
|
||||||
i20.$$TrashedLocalAssetEntityTableTableManager get trashedLocalAssetEntity =>
|
i21.$$TrashedLocalAssetEntityTableTableManager get trashedLocalAssetEntity =>
|
||||||
i20.$$TrashedLocalAssetEntityTableTableManager(
|
i21.$$TrashedLocalAssetEntityTableTableManager(
|
||||||
_db,
|
_db,
|
||||||
_db.trashedLocalAssetEntity,
|
_db.trashedLocalAssetEntity,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6912,6 +6912,487 @@ i1.GeneratedColumn<DateTime> _column_100(String aliasedName) =>
|
|||||||
true,
|
true,
|
||||||
type: i1.DriftSqlType.dateTime,
|
type: i1.DriftSqlType.dateTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final class Schema17 extends i0.VersionedSchema {
|
||||||
|
Schema17({required super.database}) : super(version: 17);
|
||||||
|
@override
|
||||||
|
late final List<i1.DatabaseSchemaEntity> entities = [
|
||||||
|
userEntity,
|
||||||
|
remoteAssetEntity,
|
||||||
|
stackEntity,
|
||||||
|
localAssetEntity,
|
||||||
|
assetEditEntity,
|
||||||
|
remoteAlbumEntity,
|
||||||
|
localAlbumEntity,
|
||||||
|
localAlbumAssetEntity,
|
||||||
|
idxLocalAssetChecksum,
|
||||||
|
idxLocalAssetCloudId,
|
||||||
|
idxRemoteAssetOwnerChecksum,
|
||||||
|
uQRemoteAssetsOwnerChecksum,
|
||||||
|
uQRemoteAssetsOwnerLibraryChecksum,
|
||||||
|
idxRemoteAssetChecksum,
|
||||||
|
authUserEntity,
|
||||||
|
userMetadataEntity,
|
||||||
|
partnerEntity,
|
||||||
|
remoteExifEntity,
|
||||||
|
remoteAlbumAssetEntity,
|
||||||
|
remoteAlbumUserEntity,
|
||||||
|
remoteAssetCloudIdEntity,
|
||||||
|
memoryEntity,
|
||||||
|
memoryAssetEntity,
|
||||||
|
personEntity,
|
||||||
|
assetFaceEntity,
|
||||||
|
storeEntity,
|
||||||
|
trashedLocalAssetEntity,
|
||||||
|
idxLatLng,
|
||||||
|
idxTrashedLocalAssetChecksum,
|
||||||
|
idxTrashedLocalAssetAlbum,
|
||||||
|
];
|
||||||
|
late final Shape20 userEntity = Shape20(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_3,
|
||||||
|
_column_84,
|
||||||
|
_column_85,
|
||||||
|
_column_91,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape17 remoteAssetEntity = Shape17(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_13,
|
||||||
|
_column_14,
|
||||||
|
_column_15,
|
||||||
|
_column_16,
|
||||||
|
_column_17,
|
||||||
|
_column_18,
|
||||||
|
_column_19,
|
||||||
|
_column_20,
|
||||||
|
_column_21,
|
||||||
|
_column_86,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape3 stackEntity = Shape3(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'stack_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [_column_0, _column_9, _column_5, _column_15, _column_75],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape26 localAssetEntity = Shape26(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_22,
|
||||||
|
_column_14,
|
||||||
|
_column_23,
|
||||||
|
_column_98,
|
||||||
|
_column_96,
|
||||||
|
_column_46,
|
||||||
|
_column_47,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape28 assetEditEntity = Shape28(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'asset_edit_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [_column_0, _column_36, _column_101, _column_102],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape9 remoteAlbumEntity = Shape9(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_56,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_57,
|
||||||
|
_column_58,
|
||||||
|
_column_59,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape19 localAlbumEntity = Shape19(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_5,
|
||||||
|
_column_31,
|
||||||
|
_column_32,
|
||||||
|
_column_90,
|
||||||
|
_column_33,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape22 localAlbumAssetEntity = Shape22(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'local_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],
|
||||||
|
columns: [_column_34, _column_35, _column_33],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
final i1.Index idxLocalAssetChecksum = i1.Index(
|
||||||
|
'idx_local_asset_checksum',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_local_asset_checksum ON local_asset_entity (checksum)',
|
||||||
|
);
|
||||||
|
final i1.Index idxLocalAssetCloudId = i1.Index(
|
||||||
|
'idx_local_asset_cloud_id',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_local_asset_cloud_id ON local_asset_entity (i_cloud_id)',
|
||||||
|
);
|
||||||
|
final i1.Index idxRemoteAssetOwnerChecksum = i1.Index(
|
||||||
|
'idx_remote_asset_owner_checksum',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_remote_asset_owner_checksum ON remote_asset_entity (owner_id, checksum)',
|
||||||
|
);
|
||||||
|
final i1.Index uQRemoteAssetsOwnerChecksum = i1.Index(
|
||||||
|
'UQ_remote_assets_owner_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_checksum ON remote_asset_entity (owner_id, checksum) WHERE(library_id IS NULL)',
|
||||||
|
);
|
||||||
|
final i1.Index uQRemoteAssetsOwnerLibraryChecksum = i1.Index(
|
||||||
|
'UQ_remote_assets_owner_library_checksum',
|
||||||
|
'CREATE UNIQUE INDEX IF NOT EXISTS UQ_remote_assets_owner_library_checksum ON remote_asset_entity (owner_id, library_id, checksum) WHERE(library_id IS NOT NULL)',
|
||||||
|
);
|
||||||
|
final i1.Index idxRemoteAssetChecksum = i1.Index(
|
||||||
|
'idx_remote_asset_checksum',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_remote_asset_checksum ON remote_asset_entity (checksum)',
|
||||||
|
);
|
||||||
|
late final Shape21 authUserEntity = Shape21(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'auth_user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_1,
|
||||||
|
_column_3,
|
||||||
|
_column_2,
|
||||||
|
_column_84,
|
||||||
|
_column_85,
|
||||||
|
_column_92,
|
||||||
|
_column_93,
|
||||||
|
_column_7,
|
||||||
|
_column_94,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape4 userMetadataEntity = Shape4(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'user_metadata_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(user_id, "key")'],
|
||||||
|
columns: [_column_25, _column_26, _column_27],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape5 partnerEntity = Shape5(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'partner_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(shared_by_id, shared_with_id)'],
|
||||||
|
columns: [_column_28, _column_29, _column_30],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape8 remoteExifEntity = Shape8(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_exif_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id)'],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_37,
|
||||||
|
_column_38,
|
||||||
|
_column_39,
|
||||||
|
_column_40,
|
||||||
|
_column_41,
|
||||||
|
_column_11,
|
||||||
|
_column_10,
|
||||||
|
_column_42,
|
||||||
|
_column_43,
|
||||||
|
_column_44,
|
||||||
|
_column_45,
|
||||||
|
_column_46,
|
||||||
|
_column_47,
|
||||||
|
_column_48,
|
||||||
|
_column_49,
|
||||||
|
_column_50,
|
||||||
|
_column_51,
|
||||||
|
_column_52,
|
||||||
|
_column_53,
|
||||||
|
_column_54,
|
||||||
|
_column_55,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape7 remoteAlbumAssetEntity = Shape7(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, album_id)'],
|
||||||
|
columns: [_column_36, _column_60],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape10 remoteAlbumUserEntity = Shape10(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_album_user_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(album_id, user_id)'],
|
||||||
|
columns: [_column_60, _column_25, _column_61],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape27 remoteAssetCloudIdEntity = Shape27(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'remote_asset_cloud_id_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id)'],
|
||||||
|
columns: [
|
||||||
|
_column_36,
|
||||||
|
_column_99,
|
||||||
|
_column_100,
|
||||||
|
_column_96,
|
||||||
|
_column_46,
|
||||||
|
_column_47,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape11 memoryEntity = Shape11(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_18,
|
||||||
|
_column_15,
|
||||||
|
_column_8,
|
||||||
|
_column_62,
|
||||||
|
_column_63,
|
||||||
|
_column_64,
|
||||||
|
_column_65,
|
||||||
|
_column_66,
|
||||||
|
_column_67,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape12 memoryAssetEntity = Shape12(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'memory_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(asset_id, memory_id)'],
|
||||||
|
columns: [_column_36, _column_68],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape14 personEntity = Shape14(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'person_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_15,
|
||||||
|
_column_1,
|
||||||
|
_column_69,
|
||||||
|
_column_71,
|
||||||
|
_column_72,
|
||||||
|
_column_73,
|
||||||
|
_column_74,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape15 assetFaceEntity = Shape15(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'asset_face_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [
|
||||||
|
_column_0,
|
||||||
|
_column_36,
|
||||||
|
_column_76,
|
||||||
|
_column_77,
|
||||||
|
_column_78,
|
||||||
|
_column_79,
|
||||||
|
_column_80,
|
||||||
|
_column_81,
|
||||||
|
_column_82,
|
||||||
|
_column_83,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape18 storeEntity = Shape18(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'store_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id)'],
|
||||||
|
columns: [_column_87, _column_88, _column_89],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
late final Shape25 trashedLocalAssetEntity = Shape25(
|
||||||
|
source: i0.VersionedTable(
|
||||||
|
entityName: 'trashed_local_asset_entity',
|
||||||
|
withoutRowId: true,
|
||||||
|
isStrict: true,
|
||||||
|
tableConstraints: ['PRIMARY KEY(id, album_id)'],
|
||||||
|
columns: [
|
||||||
|
_column_1,
|
||||||
|
_column_8,
|
||||||
|
_column_9,
|
||||||
|
_column_5,
|
||||||
|
_column_10,
|
||||||
|
_column_11,
|
||||||
|
_column_12,
|
||||||
|
_column_0,
|
||||||
|
_column_95,
|
||||||
|
_column_22,
|
||||||
|
_column_14,
|
||||||
|
_column_23,
|
||||||
|
_column_97,
|
||||||
|
],
|
||||||
|
attachedDatabase: database,
|
||||||
|
),
|
||||||
|
alias: null,
|
||||||
|
);
|
||||||
|
final i1.Index idxLatLng = i1.Index(
|
||||||
|
'idx_lat_lng',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_lat_lng ON remote_exif_entity (latitude, longitude)',
|
||||||
|
);
|
||||||
|
final i1.Index idxTrashedLocalAssetChecksum = i1.Index(
|
||||||
|
'idx_trashed_local_asset_checksum',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_checksum ON trashed_local_asset_entity (checksum)',
|
||||||
|
);
|
||||||
|
final i1.Index idxTrashedLocalAssetAlbum = i1.Index(
|
||||||
|
'idx_trashed_local_asset_album',
|
||||||
|
'CREATE INDEX IF NOT EXISTS idx_trashed_local_asset_album ON trashed_local_asset_entity (album_id)',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shape28 extends i0.VersionedTable {
|
||||||
|
Shape28({required super.source, required super.alias}) : super.aliased();
|
||||||
|
i1.GeneratedColumn<String> get id =>
|
||||||
|
columnsByName['id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<String> get assetId =>
|
||||||
|
columnsByName['asset_id']! as i1.GeneratedColumn<String>;
|
||||||
|
i1.GeneratedColumn<int> get action =>
|
||||||
|
columnsByName['action']! as i1.GeneratedColumn<int>;
|
||||||
|
i1.GeneratedColumn<i2.Uint8List> get parameters =>
|
||||||
|
columnsByName['parameters']! as i1.GeneratedColumn<i2.Uint8List>;
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.GeneratedColumn<int> _column_101(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<int>(
|
||||||
|
'action',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i1.DriftSqlType.int,
|
||||||
|
);
|
||||||
|
i1.GeneratedColumn<i2.Uint8List> _column_102(String aliasedName) =>
|
||||||
|
i1.GeneratedColumn<i2.Uint8List>(
|
||||||
|
'parameters',
|
||||||
|
aliasedName,
|
||||||
|
false,
|
||||||
|
type: i1.DriftSqlType.blob,
|
||||||
|
);
|
||||||
i0.MigrationStepWithVersion migrationSteps({
|
i0.MigrationStepWithVersion migrationSteps({
|
||||||
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
required Future<void> Function(i1.Migrator m, Schema2 schema) from1To2,
|
||||||
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
required Future<void> Function(i1.Migrator m, Schema3 schema) from2To3,
|
||||||
@@ -6928,6 +7409,7 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
required Future<void> Function(i1.Migrator m, Schema14 schema) from13To14,
|
required Future<void> Function(i1.Migrator m, Schema14 schema) from13To14,
|
||||||
required Future<void> Function(i1.Migrator m, Schema15 schema) from14To15,
|
required Future<void> Function(i1.Migrator m, Schema15 schema) from14To15,
|
||||||
required Future<void> Function(i1.Migrator m, Schema16 schema) from15To16,
|
required Future<void> Function(i1.Migrator m, Schema16 schema) from15To16,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema17 schema) from16To17,
|
||||||
}) {
|
}) {
|
||||||
return (currentVersion, database) async {
|
return (currentVersion, database) async {
|
||||||
switch (currentVersion) {
|
switch (currentVersion) {
|
||||||
@@ -7006,6 +7488,11 @@ i0.MigrationStepWithVersion migrationSteps({
|
|||||||
final migrator = i1.Migrator(database, schema);
|
final migrator = i1.Migrator(database, schema);
|
||||||
await from15To16(migrator, schema);
|
await from15To16(migrator, schema);
|
||||||
return 16;
|
return 16;
|
||||||
|
case 16:
|
||||||
|
final schema = Schema17(database: database);
|
||||||
|
final migrator = i1.Migrator(database, schema);
|
||||||
|
await from16To17(migrator, schema);
|
||||||
|
return 17;
|
||||||
default:
|
default:
|
||||||
throw ArgumentError.value('Unknown migration from $currentVersion');
|
throw ArgumentError.value('Unknown migration from $currentVersion');
|
||||||
}
|
}
|
||||||
@@ -7028,6 +7515,7 @@ i1.OnUpgrade stepByStep({
|
|||||||
required Future<void> Function(i1.Migrator m, Schema14 schema) from13To14,
|
required Future<void> Function(i1.Migrator m, Schema14 schema) from13To14,
|
||||||
required Future<void> Function(i1.Migrator m, Schema15 schema) from14To15,
|
required Future<void> Function(i1.Migrator m, Schema15 schema) from14To15,
|
||||||
required Future<void> Function(i1.Migrator m, Schema16 schema) from15To16,
|
required Future<void> Function(i1.Migrator m, Schema16 schema) from15To16,
|
||||||
|
required Future<void> Function(i1.Migrator m, Schema17 schema) from16To17,
|
||||||
}) => i0.VersionedSchema.stepByStepHelper(
|
}) => i0.VersionedSchema.stepByStepHelper(
|
||||||
step: migrationSteps(
|
step: migrationSteps(
|
||||||
from1To2: from1To2,
|
from1To2: from1To2,
|
||||||
@@ -7045,5 +7533,6 @@ i1.OnUpgrade stepByStep({
|
|||||||
from13To14: from13To14,
|
from13To14: from13To14,
|
||||||
from14To15: from14To15,
|
from14To15: from14To15,
|
||||||
from15To16: from15To16,
|
from15To16: from15To16,
|
||||||
|
from16To17: from16To17,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -185,13 +185,25 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<LocalAsset>> getAssets(String albumId) {
|
Future<List<LocalAsset>> getAssets(String albumId) {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.localAlbumAssetEntity.select().join([
|
_db.localAlbumAssetEntity.select().join([
|
||||||
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
|
..addColumns([hasEdits])
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
||||||
return query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
|
||||||
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> getAssetIds(String albumId) {
|
Future<List<String>> getAssetIds(String albumId) {
|
||||||
@@ -236,14 +248,25 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<LocalAsset>> getAssetsToHash(String albumId) {
|
Future<List<LocalAsset>> getAssetsToHash(String albumId) {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.localAlbumAssetEntity.select().join([
|
_db.localAlbumAssetEntity.select().join([
|
||||||
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
|
..addColumns([hasEdits])
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId) & _db.localAssetEntity.checksum.isNull())
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId) & _db.localAssetEntity.checksum.isNull())
|
||||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)]);
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateCloudMapping(Map<String, String> cloudMapping) {
|
Future<void> updateCloudMapping(Map<String, String> cloudMapping) {
|
||||||
@@ -414,15 +437,29 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<LocalAsset?> getThumbnail(String albumId) async {
|
Future<LocalAsset?> getThumbnail(String albumId) async {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
final query =
|
final query =
|
||||||
_db.localAlbumAssetEntity.select().join([
|
_db.localAlbumAssetEntity.select().join([
|
||||||
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
|
..addColumns([hasEdits])
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
||||||
..orderBy([OrderingTerm.desc(_db.localAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.localAssetEntity.createdAt)])
|
||||||
..limit(1);
|
..limit(1);
|
||||||
|
|
||||||
final results = await query.map((row) => row.readTable(_db.localAssetEntity).toDto()).get();
|
final results = await query
|
||||||
|
.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!))
|
||||||
|
.get();
|
||||||
|
|
||||||
return results.isNotEmpty ? results.first : null;
|
return results.isNotEmpty ? results.first : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,22 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
const DriftLocalAssetRepository(this._db) : super(_db);
|
const DriftLocalAssetRepository(this._db) : super(_db);
|
||||||
|
|
||||||
SingleOrNullSelectable<LocalAsset?> _assetSelectable(String id) {
|
SingleOrNullSelectable<LocalAsset?> _assetSelectable(String id) {
|
||||||
final query = _db.localAssetEntity.select().addColumns([_db.remoteAssetEntity.id]).join([
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
final query = _db.localAssetEntity.select().addColumns([_db.remoteAssetEntity.id, hasEdits]).join([
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])..where(_db.localAssetEntity.id.equals(id));
|
])..where(_db.localAssetEntity.id.equals(id));
|
||||||
|
|
||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final asset = row.readTable(_db.localAssetEntity).toDto();
|
final asset = row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!);
|
||||||
return asset.copyWith(remoteId: row.read(_db.remoteAssetEntity.id));
|
return asset.copyWith(remoteId: row.read(_db.remoteAssetEntity.id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -34,9 +40,24 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
Future<LocalAsset?> get(String id) => _assetSelectable(id).getSingleOrNull();
|
Future<LocalAsset?> get(String id) => _assetSelectable(id).getSingleOrNull();
|
||||||
|
|
||||||
Future<List<LocalAsset?>> getByChecksum(String checksum) {
|
Future<List<LocalAsset?>> getByChecksum(String checksum) {
|
||||||
final query = _db.localAssetEntity.select()..where((lae) => lae.checksum.equals(checksum));
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).get();
|
final query =
|
||||||
|
_db.localAssetEntity.select().join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(_db.localAssetEntity.checksum.equals(checksum))
|
||||||
|
..addColumns([hasEdits]);
|
||||||
|
|
||||||
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<LocalAsset?> watch(String id) => _assetSelectable(id).watchSingleOrNull();
|
Stream<LocalAsset?> watch(String id) => _assetSelectable(id).watchSingleOrNull();
|
||||||
@@ -70,9 +91,25 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<LocalAsset?> getById(String id) {
|
Future<LocalAsset?> getById(String id) {
|
||||||
final query = _db.localAssetEntity.select()..where((lae) => lae.id.equals(id));
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
final query =
|
||||||
|
_db.localAssetEntity.select().join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(_db.localAssetEntity.id.equals(id))
|
||||||
|
..addColumns([hasEdits]);
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).getSingleOrNull();
|
return query
|
||||||
|
.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!))
|
||||||
|
.getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getCount() {
|
Future<int> getCount() {
|
||||||
@@ -108,22 +145,34 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final result = <String, List<LocalAsset>>{};
|
final result = <String, List<LocalAsset>>{};
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
for (final slice in checksums.toSet().slices(kDriftMaxChunk)) {
|
for (final slice in checksums.toSet().slices(kDriftMaxChunk)) {
|
||||||
final rows =
|
final rows =
|
||||||
await (_db.select(_db.localAlbumAssetEntity).join([
|
await (_db.select(_db.localAlbumAssetEntity).join([
|
||||||
innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),
|
innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),
|
||||||
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
||||||
])..where(
|
leftOuterJoin(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
_db.remoteAssetEntity,
|
||||||
_db.localAssetEntity.checksum.isIn(slice),
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
))
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..addColumns([hasEdits])
|
||||||
|
..where(
|
||||||
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
||||||
|
_db.localAssetEntity.checksum.isIn(slice),
|
||||||
|
))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
for (final row in rows) {
|
for (final row in rows) {
|
||||||
final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;
|
final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;
|
||||||
final assetData = row.readTable(_db.localAssetEntity);
|
final assetData = row.readTable(_db.localAssetEntity);
|
||||||
final asset = assetData.toDto();
|
final asset = assetData.toDto(isEdited: row.read(hasEdits)!);
|
||||||
(result[albumId] ??= <LocalAsset>[]).add(asset);
|
(result[albumId] ??= <LocalAsset>[]).add(asset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +185,7 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
AssetFilterType filterType = AssetFilterType.all,
|
AssetFilterType filterType = AssetFilterType.all,
|
||||||
bool keepFavorites = true,
|
bool keepFavorites = true,
|
||||||
}) async {
|
}) async {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final iosSharedAlbumAssets = _db.localAlbumAssetEntity.selectOnly()
|
final iosSharedAlbumAssets = _db.localAlbumAssetEntity.selectOnly()
|
||||||
..addColumns([_db.localAlbumAssetEntity.assetId])
|
..addColumns([_db.localAlbumAssetEntity.assetId])
|
||||||
..join([
|
..join([
|
||||||
@@ -149,7 +199,12 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
final query = _db.localAssetEntity.select().join([
|
final query = _db.localAssetEntity.select().join([
|
||||||
innerJoin(_db.remoteAssetEntity, _db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum)),
|
innerJoin(_db.remoteAssetEntity, _db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum)),
|
||||||
]);
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])..addColumns([hasEdits]);
|
||||||
|
|
||||||
Expression<bool> whereClause =
|
Expression<bool> whereClause =
|
||||||
_db.localAssetEntity.createdAt.isSmallerOrEqualValue(cutoffDate) &
|
_db.localAssetEntity.createdAt.isSmallerOrEqualValue(cutoffDate) &
|
||||||
@@ -172,12 +227,28 @@ class DriftLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
query.where(whereClause);
|
query.where(whereClause);
|
||||||
|
|
||||||
final rows = await query.get();
|
final rows = await query.get();
|
||||||
return rows.map((row) => row.readTable(_db.localAssetEntity).toDto()).toList();
|
return rows.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<LocalAsset>> getEmptyCloudIdAssets() {
|
Future<List<LocalAsset>> getEmptyCloudIdAssets() {
|
||||||
final query = _db.localAssetEntity.select()..where((row) => row.iCloudId.isNull());
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
return query.map((row) => row.toDto()).get();
|
final query =
|
||||||
|
_db.localAssetEntity.select().join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.remoteAssetEntity,
|
||||||
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..addColumns([isEdited])
|
||||||
|
..where(_db.localAssetEntity.iCloudId.isNull());
|
||||||
|
|
||||||
|
return query.map((row) => row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, String>> getHashMappingFromCloudId() async {
|
Future<Map<String, String>> getHashMappingFromCloudId() async {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
Future<List<DriftMemory>> getAll(String ownerId) async {
|
Future<List<DriftMemory>> getAll(String ownerId) async {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
final localUtc = DateTime.utc(now.year, now.month, now.day, 0, 0, 0);
|
final localUtc = DateTime.utc(now.year, now.month, now.day, 0, 0, 0);
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.select(_db.memoryEntity).join([
|
_db.select(_db.memoryEntity).addColumns([hasEdits]).join([
|
||||||
innerJoin(_db.memoryAssetEntity, _db.memoryAssetEntity.memoryId.equalsExp(_db.memoryEntity.id)),
|
innerJoin(_db.memoryAssetEntity, _db.memoryAssetEntity.memoryId.equalsExp(_db.memoryEntity.id)),
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
@@ -22,6 +22,11 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..where(_db.memoryEntity.ownerId.equals(ownerId))
|
..where(_db.memoryEntity.ownerId.equals(ownerId))
|
||||||
..where(_db.memoryEntity.deletedAt.isNull())
|
..where(_db.memoryEntity.deletedAt.isNull())
|
||||||
@@ -42,9 +47,9 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
final existingMemory = memoriesMap[memory.id];
|
final existingMemory = memoriesMap[memory.id];
|
||||||
if (existingMemory != null) {
|
if (existingMemory != null) {
|
||||||
existingMemory.assets.add(asset.toDto());
|
existingMemory.assets.add(asset.toDto(isEdited: row.read(hasEdits)!));
|
||||||
} else {
|
} else {
|
||||||
final assets = [asset.toDto()];
|
final assets = [asset.toDto(isEdited: row.read(hasEdits)!)];
|
||||||
memoriesMap[memory.id] = memory.toDto().copyWith(assets: assets);
|
memoriesMap[memory.id] = memory.toDto().copyWith(assets: assets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,8 +58,9 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<DriftMemory?> get(String memoryId) async {
|
Future<DriftMemory?> get(String memoryId) async {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.select(_db.memoryEntity).join([
|
_db.select(_db.memoryEntity).addColumns([hasEdits]).join([
|
||||||
leftOuterJoin(_db.memoryAssetEntity, _db.memoryAssetEntity.memoryId.equalsExp(_db.memoryEntity.id)),
|
leftOuterJoin(_db.memoryAssetEntity, _db.memoryAssetEntity.memoryId.equalsExp(_db.memoryEntity.id)),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
@@ -62,6 +68,11 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..where(_db.memoryEntity.id.equals(memoryId))
|
..where(_db.memoryEntity.id.equals(memoryId))
|
||||||
..where(_db.memoryEntity.deletedAt.isNull())
|
..where(_db.memoryEntity.deletedAt.isNull())
|
||||||
@@ -78,7 +89,7 @@ class DriftMemoryRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
for (final row in rows) {
|
for (final row in rows) {
|
||||||
final asset = row.readTable(_db.remoteAssetEntity);
|
final asset = row.readTable(_db.remoteAssetEntity);
|
||||||
assets.add(asset.toDto());
|
assets.add(asset.toDto(isEdited: row.read(hasEdits)!));
|
||||||
}
|
}
|
||||||
|
|
||||||
return memory.toDto().copyWith(assets: assets);
|
return memory.toDto().copyWith(assets: assets);
|
||||||
|
|||||||
@@ -231,11 +231,17 @@ class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<RemoteAsset>> getAssets(String albumId) {
|
Future<List<RemoteAsset>> getAssets(String albumId) {
|
||||||
final query = _db.remoteAlbumAssetEntity.select().join([
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
|
final query = _db.remoteAlbumAssetEntity.select().addColumns([isEdited]).join([
|
||||||
innerJoin(_db.remoteAssetEntity, _db.remoteAssetEntity.id.equalsExp(_db.remoteAlbumAssetEntity.assetId)),
|
innerJoin(_db.remoteAssetEntity, _db.remoteAssetEntity.id.equalsExp(_db.remoteAlbumAssetEntity.assetId)),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
])..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> addAssets(String albumId, List<String> assetIds) async {
|
Future<int> addAssets(String albumId, List<String> assetIds) async {
|
||||||
|
|||||||
@@ -17,33 +17,47 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
/// For testing purposes
|
/// For testing purposes
|
||||||
Future<List<RemoteAsset>> getSome(String userId) {
|
Future<List<RemoteAsset>> getSome(String userId) {
|
||||||
final query = _db.remoteAssetEntity.select()
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
..where(
|
|
||||||
(row) =>
|
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId) &
|
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
|
||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
|
||||||
)
|
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
|
||||||
..limit(10);
|
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).get();
|
final query =
|
||||||
|
_db.remoteAssetEntity.select().addColumns([isEdited]).join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.remoteAssetEntity.id.equalsExp(_db.assetEditEntity.assetId),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(
|
||||||
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline),
|
||||||
|
)
|
||||||
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
|
..limit(10);
|
||||||
|
|
||||||
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleOrNullSelectable<RemoteAsset?> _assetSelectable(String id) {
|
SingleOrNullSelectable<RemoteAsset?> _assetSelectable(String id) {
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.remoteAssetEntity.select().addColumns([_db.localAssetEntity.id]).join([
|
_db.remoteAssetEntity.select().addColumns([_db.localAssetEntity.id, hasEdits]).join([
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.localAssetEntity,
|
_db.localAssetEntity,
|
||||||
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.remoteAssetEntity.id.equalsExp(_db.assetEditEntity.assetId),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..where(_db.remoteAssetEntity.id.equals(id))
|
..where(_db.remoteAssetEntity.id.equals(id))
|
||||||
..limit(1);
|
..limit(1);
|
||||||
|
|
||||||
return query.map((row) {
|
return query.map((row) {
|
||||||
final asset = row.readTable(_db.remoteAssetEntity).toDto();
|
final asset = row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(hasEdits)!);
|
||||||
return asset.copyWith(localId: row.read(_db.localAssetEntity.id));
|
return asset.copyWith(localId: row.read(_db.localAssetEntity.id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -57,9 +71,19 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<RemoteAsset?> getByChecksum(String checksum) {
|
Future<RemoteAsset?> getByChecksum(String checksum) {
|
||||||
final query = _db.remoteAssetEntity.select()..where((row) => row.checksum.equals(checksum));
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).getSingleOrNull();
|
final query = _db.remoteAssetEntity.select().addColumns([isEdited]).join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.remoteAssetEntity.id.equalsExp(_db.assetEditEntity.assetId),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])..where(_db.remoteAssetEntity.checksum.equals(checksum));
|
||||||
|
|
||||||
|
return query
|
||||||
|
.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!))
|
||||||
|
.getSingleOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<RemoteAsset>> getStackChildren(RemoteAsset asset) {
|
Future<List<RemoteAsset>> getStackChildren(RemoteAsset asset) {
|
||||||
@@ -68,11 +92,20 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
|||||||
return Future.value(const []);
|
return Future.value(const []);
|
||||||
}
|
}
|
||||||
|
|
||||||
final query = _db.remoteAssetEntity.select()
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
..where((row) => row.stackId.equals(stackId) & row.id.equals(asset.id).not())
|
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)]);
|
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).get();
|
final query =
|
||||||
|
_db.remoteAssetEntity.select().addColumns([isEdited]).join([
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.remoteAssetEntity.id.equalsExp(_db.assetEditEntity.assetId),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(_db.remoteAssetEntity.stackId.equals(stackId) & _db.remoteAssetEntity.id.equals(asset.id).not())
|
||||||
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)]);
|
||||||
|
|
||||||
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ExifInfo?> getExif(String id) {
|
Future<ExifInfo?> getExif(String id) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class SyncApiRepository {
|
|||||||
SyncRequestType.authUsersV1,
|
SyncRequestType.authUsersV1,
|
||||||
SyncRequestType.usersV1,
|
SyncRequestType.usersV1,
|
||||||
SyncRequestType.assetsV1,
|
SyncRequestType.assetsV1,
|
||||||
|
SyncRequestType.assetEditsV1,
|
||||||
SyncRequestType.assetExifsV1,
|
SyncRequestType.assetExifsV1,
|
||||||
SyncRequestType.assetMetadataV1,
|
SyncRequestType.assetMetadataV1,
|
||||||
SyncRequestType.partnersV1,
|
SyncRequestType.partnersV1,
|
||||||
@@ -148,6 +149,8 @@ const _kResponseMap = <SyncEntityType, Function(Object)>{
|
|||||||
SyncEntityType.partnerDeleteV1: SyncPartnerDeleteV1.fromJson,
|
SyncEntityType.partnerDeleteV1: SyncPartnerDeleteV1.fromJson,
|
||||||
SyncEntityType.assetV1: SyncAssetV1.fromJson,
|
SyncEntityType.assetV1: SyncAssetV1.fromJson,
|
||||||
SyncEntityType.assetDeleteV1: SyncAssetDeleteV1.fromJson,
|
SyncEntityType.assetDeleteV1: SyncAssetDeleteV1.fromJson,
|
||||||
|
SyncEntityType.assetEditV1: SyncAssetEditV1.fromJson,
|
||||||
|
SyncEntityType.assetEditDeleteV1: SyncAssetEditDeleteV1.fromJson,
|
||||||
SyncEntityType.assetExifV1: SyncAssetExifV1.fromJson,
|
SyncEntityType.assetExifV1: SyncAssetExifV1.fromJson,
|
||||||
SyncEntityType.assetMetadataV1: SyncAssetMetadataV1.fromJson,
|
SyncEntityType.assetMetadataV1: SyncAssetMetadataV1.fromJson,
|
||||||
SyncEntityType.assetMetadataDeleteV1: SyncAssetMetadataDeleteV1.fromJson,
|
SyncEntityType.assetMetadataDeleteV1: SyncAssetMetadataDeleteV1.fromJson,
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ import 'package:collection/collection.dart';
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:immich_mobile/constants/constants.dart';
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/asset/asset_edit.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/memory.model.dart';
|
import 'package:immich_mobile/domain/models/memory.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/asset_edit.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/asset_face.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/auth_user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||||
@@ -26,8 +28,8 @@ import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift
|
|||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
|
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart' as api show AssetVisibility, AlbumUserRole, UserMetadataKey;
|
import 'package:openapi/api.dart' as api show AssetVisibility, AlbumUserRole, UserMetadataKey, AssetEditAction;
|
||||||
import 'package:openapi/api.dart' hide AssetVisibility, AlbumUserRole, UserMetadataKey;
|
import 'package:openapi/api.dart' hide AssetVisibility, AlbumUserRole, UserMetadataKey, AssetEditAction;
|
||||||
|
|
||||||
class SyncStreamRepository extends DriftDatabaseRepository {
|
class SyncStreamRepository extends DriftDatabaseRepository {
|
||||||
final Logger _logger = Logger('DriftSyncStreamRepository');
|
final Logger _logger = Logger('DriftSyncStreamRepository');
|
||||||
@@ -215,6 +217,39 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> updateAssetEditsV1(Iterable<SyncAssetEditV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final edit in data) {
|
||||||
|
final companion = AssetEditEntityCompanion(
|
||||||
|
id: Value(edit.id),
|
||||||
|
assetId: Value(edit.assetId),
|
||||||
|
action: Value(edit.action.toAssetEditAction()),
|
||||||
|
parameters: Value(edit.parameters as Map<String, Object?>),
|
||||||
|
);
|
||||||
|
|
||||||
|
batch.insert(_db.assetEditEntity, companion, onConflict: DoUpdate((_) => companion));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error, stack) {
|
||||||
|
_logger.severe('Error: updateAssetEditsV1', error, stack);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAssetEditsV1(Iterable<SyncAssetEditDeleteV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final edit in data) {
|
||||||
|
batch.deleteWhere(_db.assetEditEntity, (row) => row.assetId.equals(edit.assetId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error, stack) {
|
||||||
|
_logger.severe('Error: deleteAssetEditsV1', error, stack);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> updateAssetsExifV1(Iterable<SyncAssetExifV1> data, {String debugLabel = 'user'}) async {
|
Future<void> updateAssetsExifV1(Iterable<SyncAssetExifV1> data, {String debugLabel = 'user'}) async {
|
||||||
try {
|
try {
|
||||||
await _db.batch((batch) {
|
await _db.batch((batch) {
|
||||||
@@ -764,3 +799,12 @@ extension on String {
|
|||||||
extension on UserAvatarColor {
|
extension on UserAvatarColor {
|
||||||
AvatarColor? toAvatarColor() => AvatarColor.values.firstWhereOrNull((c) => c.name == value);
|
AvatarColor? toAvatarColor() => AvatarColor.values.firstWhereOrNull((c) => c.name == value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension on api.AssetEditAction {
|
||||||
|
AssetEditAction toAssetEditAction() => switch (this) {
|
||||||
|
api.AssetEditAction.crop => AssetEditAction.crop,
|
||||||
|
api.AssetEditAction.rotate => AssetEditAction.rotate,
|
||||||
|
api.AssetEditAction.mirror => AssetEditAction.rotate,
|
||||||
|
_ => AssetEditAction.other,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
durationInSeconds: row.durationInSeconds,
|
durationInSeconds: row.durationInSeconds,
|
||||||
livePhotoVideoId: row.livePhotoVideoId,
|
livePhotoVideoId: row.livePhotoVideoId,
|
||||||
stackId: row.stackId,
|
stackId: row.stackId,
|
||||||
|
isEdited: row.isEdited == 1,
|
||||||
)
|
)
|
||||||
: LocalAsset(
|
: LocalAsset(
|
||||||
id: row.localId!,
|
id: row.localId!,
|
||||||
@@ -88,6 +89,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
latitude: row.latitude,
|
latitude: row.latitude,
|
||||||
longitude: row.longitude,
|
longitude: row.longitude,
|
||||||
adjustmentTime: row.adjustmentTime,
|
adjustmentTime: row.adjustmentTime,
|
||||||
|
isEdited: false,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
@@ -136,6 +138,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<BaseAsset>> _getLocalAlbumBucketAssets(String albumId, {required int offset, required int count}) {
|
Future<List<BaseAsset>> _getLocalAlbumBucketAssets(String albumId, {required int offset, required int count}) {
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.localAssetEntity.select().join([
|
_db.localAssetEntity.select().join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
@@ -148,14 +151,23 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
_db.localAssetEntity.checksum.equalsExp(_db.remoteAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..addColumns([_db.remoteAssetEntity.id])
|
..addColumns([_db.remoteAssetEntity.id, isEdited])
|
||||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
||||||
..orderBy([OrderingTerm.desc(_db.localAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.localAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
|
|
||||||
return query
|
return query
|
||||||
.map((row) => row.readTable(_db.localAssetEntity).toDto(remoteId: row.read(_db.remoteAssetEntity.id)))
|
.map(
|
||||||
|
(row) => row
|
||||||
|
.readTable(_db.localAssetEntity)
|
||||||
|
.toDto(isEdited: row.read(isEdited)!, remoteId: row.read(_db.remoteAssetEntity.id)),
|
||||||
|
)
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,8 +236,9 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final isAscending = albumData.order == AlbumAssetOrder.asc;
|
final isAscending = albumData.order == AlbumAssetOrder.asc;
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
final query = _db.remoteAssetEntity.select().addColumns([_db.localAssetEntity.id]).join([
|
final query = _db.remoteAssetEntity.select().addColumns([_db.localAssetEntity.id, isEdited]).join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
_db.remoteAlbumAssetEntity,
|
_db.remoteAlbumAssetEntity,
|
||||||
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.remoteAlbumAssetEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
@@ -236,6 +249,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])..where(_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
])..where(_db.remoteAssetEntity.deletedAt.isNull() & _db.remoteAlbumAssetEntity.albumId.equals(albumId));
|
||||||
|
|
||||||
if (isAscending) {
|
if (isAscending) {
|
||||||
@@ -247,7 +265,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
query.limit(count, offset: offset);
|
query.limit(count, offset: offset);
|
||||||
|
|
||||||
return query
|
return query
|
||||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto(localId: row.read(_db.localAssetEntity.id)))
|
.map(
|
||||||
|
(row) => row
|
||||||
|
.readTable(_db.remoteAssetEntity)
|
||||||
|
.toDto(isEdited: row.read(isEdited)!, localId: row.read(_db.localAssetEntity.id)),
|
||||||
|
)
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,6 +391,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<BaseAsset>> _getPlaceBucketAssets(String place, {required int offset, required int count}) {
|
Future<List<BaseAsset>> _getPlaceBucketAssets(String place, {required int offset, required int count}) {
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.remoteAssetEntity.select().join([
|
_db.remoteAssetEntity.select().join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
@@ -376,7 +399,13 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
|
..addColumns([isEdited])
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
||||||
@@ -384,7 +413,8 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
)
|
)
|
||||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
|
||||||
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<List<Bucket>> _watchPersonBucket(String userId, String personId, {GroupAssetsBy groupBy = GroupAssetsBy.day}) {
|
Stream<List<Bucket>> _watchPersonBucket(String userId, String personId, {GroupAssetsBy groupBy = GroupAssetsBy.day}) {
|
||||||
@@ -445,6 +475,8 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
required int offset,
|
required int offset,
|
||||||
required int count,
|
required int count,
|
||||||
}) {
|
}) {
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
|
|
||||||
final query =
|
final query =
|
||||||
_db.remoteAssetEntity.select().join([
|
_db.remoteAssetEntity.select().join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
@@ -452,6 +484,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.assetFaceEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.assetFaceEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.deletedAt.isNull() &
|
_db.remoteAssetEntity.deletedAt.isNull() &
|
||||||
@@ -459,10 +496,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
||||||
_db.assetFaceEntity.personId.equals(personId),
|
_db.assetFaceEntity.personId.equals(personId),
|
||||||
)
|
)
|
||||||
|
..addColumns([isEdited])
|
||||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
|
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineQuery map(String userId, LatLngBounds bounds, GroupAssetsBy groupBy) => (
|
TimelineQuery map(String userId, LatLngBounds bounds, GroupAssetsBy groupBy) => (
|
||||||
@@ -515,6 +553,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
required int offset,
|
required int offset,
|
||||||
required int count,
|
required int count,
|
||||||
}) {
|
}) {
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.remoteAssetEntity.select().join([
|
_db.remoteAssetEntity.select().join([
|
||||||
innerJoin(
|
innerJoin(
|
||||||
@@ -522,6 +561,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
_db.remoteExifEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..where(
|
..where(
|
||||||
_db.remoteAssetEntity.ownerId.equals(userId) &
|
_db.remoteAssetEntity.ownerId.equals(userId) &
|
||||||
@@ -529,9 +573,11 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
_db.remoteAssetEntity.visibility.equalsValue(AssetVisibility.timeline) &
|
||||||
_db.remoteAssetEntity.deletedAt.isNull(),
|
_db.remoteAssetEntity.deletedAt.isNull(),
|
||||||
)
|
)
|
||||||
|
..addColumns([isEdited])
|
||||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto()).get();
|
|
||||||
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@@ -582,6 +628,7 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
bool joinLocal = false,
|
bool joinLocal = false,
|
||||||
}) {
|
}) {
|
||||||
if (joinLocal) {
|
if (joinLocal) {
|
||||||
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
final query =
|
final query =
|
||||||
_db.remoteAssetEntity.select().join([
|
_db.remoteAssetEntity.select().join([
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
@@ -589,22 +636,40 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
useColumns: false,
|
useColumns: false,
|
||||||
),
|
),
|
||||||
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
])
|
])
|
||||||
..addColumns([_db.localAssetEntity.id])
|
..addColumns([_db.localAssetEntity.id, isEdited])
|
||||||
..where(filter(_db.remoteAssetEntity))
|
..where(filter(_db.remoteAssetEntity))
|
||||||
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
..limit(count, offset: offset);
|
..limit(count, offset: offset);
|
||||||
|
|
||||||
return query
|
return query
|
||||||
.map((row) => row.readTable(_db.remoteAssetEntity).toDto(localId: row.read(_db.localAssetEntity.id)))
|
.map(
|
||||||
|
(row) => row
|
||||||
|
.readTable(_db.remoteAssetEntity)
|
||||||
|
.toDto(isEdited: row.read(isEdited)!, localId: row.read(_db.localAssetEntity.id)),
|
||||||
|
)
|
||||||
.get();
|
.get();
|
||||||
} else {
|
} else {
|
||||||
final query = _db.remoteAssetEntity.select()
|
final isEdited = _db.assetEditEntity.id.isNotNull();
|
||||||
..where(filter)
|
final query =
|
||||||
..orderBy([(row) => OrderingTerm.desc(row.createdAt)])
|
_db.remoteAssetEntity.select().join([
|
||||||
..limit(count, offset: offset);
|
leftOuterJoin(
|
||||||
|
_db.assetEditEntity,
|
||||||
|
_db.remoteAssetEntity.id.equalsExp(_db.assetEditEntity.assetId),
|
||||||
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..addColumns([isEdited])
|
||||||
|
..where(filter(_db.remoteAssetEntity))
|
||||||
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
|
..limit(count, offset: offset);
|
||||||
|
|
||||||
return query.map((row) => row.toDto()).get();
|
return query.map((row) => row.readTable(_db.remoteAssetEntity).toDto(isEdited: row.read(isEdited)!)).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,24 +262,31 @@ class DriftTrashedLocalAssetRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
Future<Map<String, List<LocalAsset>>> getToTrash() async {
|
Future<Map<String, List<LocalAsset>>> getToTrash() async {
|
||||||
final result = <String, List<LocalAsset>>{};
|
final result = <String, List<LocalAsset>>{};
|
||||||
|
final hasEdits = _db.assetEditEntity.id.isNotNull();
|
||||||
final rows =
|
final rows =
|
||||||
await (_db.select(_db.localAlbumAssetEntity).join([
|
await (_db.select(_db.localAlbumAssetEntity).join([
|
||||||
innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),
|
innerJoin(_db.localAlbumEntity, _db.localAlbumAssetEntity.albumId.equalsExp(_db.localAlbumEntity.id)),
|
||||||
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
innerJoin(_db.localAssetEntity, _db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id)),
|
||||||
leftOuterJoin(
|
leftOuterJoin(
|
||||||
_db.remoteAssetEntity,
|
_db.remoteAssetEntity,
|
||||||
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
_db.remoteAssetEntity.checksum.equalsExp(_db.localAssetEntity.checksum),
|
||||||
),
|
),
|
||||||
])..where(
|
leftOuterJoin(
|
||||||
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
_db.assetEditEntity,
|
||||||
_db.remoteAssetEntity.deletedAt.isNotNull(),
|
_db.assetEditEntity.assetId.equalsExp(_db.remoteAssetEntity.id),
|
||||||
))
|
useColumns: false,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..addColumns([hasEdits])
|
||||||
|
..where(
|
||||||
|
_db.localAlbumEntity.backupSelection.equalsValue(BackupSelection.selected) &
|
||||||
|
_db.remoteAssetEntity.deletedAt.isNotNull(),
|
||||||
|
))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
for (final row in rows) {
|
for (final row in rows) {
|
||||||
final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;
|
final albumId = row.readTable(_db.localAlbumAssetEntity).albumId;
|
||||||
final asset = row.readTable(_db.localAssetEntity).toDto();
|
final asset = row.readTable(_db.localAssetEntity).toDto(isEdited: row.read(hasEdits)!);
|
||||||
(result[albumId] ??= <LocalAsset>[]).add(asset);
|
(result[albumId] ??= <LocalAsset>[]).add(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class _AssetPropertiesSectionState extends ConsumerState<_AssetPropertiesSection
|
|||||||
),
|
),
|
||||||
_PropertyItem(label: 'Is Favorite', value: asset.isFavorite.toString()),
|
_PropertyItem(label: 'Is Favorite', value: asset.isFavorite.toString()),
|
||||||
_PropertyItem(label: 'Live Photo Video ID', value: asset.livePhotoVideoId),
|
_PropertyItem(label: 'Live Photo Video ID', value: asset.livePhotoVideoId),
|
||||||
|
_PropertyItem(label: 'Is Edited', value: asset.isEdited.toString()),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,4 +136,4 @@ ImageProvider? getThumbnailImageProvider(BaseAsset asset, {Size size = kThumbnai
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool _shouldUseLocalAsset(BaseAsset asset) =>
|
bool _shouldUseLocalAsset(BaseAsset asset) =>
|
||||||
asset.hasLocal && (!asset.hasRemote || !AppSetting.get(Setting.preferRemoteImage));
|
asset.hasLocal && !asset.isEdited && (!asset.hasRemote || !AppSetting.get(Setting.preferRemoteImage));
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ class CastNotifier extends StateNotifier<CastManagerState> {
|
|||||||
: AssetType.other,
|
: AssetType.other,
|
||||||
createdAt: asset.fileCreatedAt,
|
createdAt: asset.fileCreatedAt,
|
||||||
updatedAt: asset.updatedAt,
|
updatedAt: asset.updatedAt,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
_gCastService.loadMedia(remoteAsset, reload);
|
_gCastService.loadMedia(remoteAsset, reload);
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
|
|||||||
socket.on('on_asset_trash', _handleOnAssetTrash);
|
socket.on('on_asset_trash', _handleOnAssetTrash);
|
||||||
socket.on('on_asset_restore', _handleServerUpdates);
|
socket.on('on_asset_restore', _handleServerUpdates);
|
||||||
socket.on('on_asset_update', _handleServerUpdates);
|
socket.on('on_asset_update', _handleServerUpdates);
|
||||||
|
socket.on('AssetEditReadyV1', _handleServerUpdates);
|
||||||
socket.on('on_asset_stack_update', _handleServerUpdates);
|
socket.on('on_asset_stack_update', _handleServerUpdates);
|
||||||
socket.on('on_asset_hidden', _handleOnAssetHidden);
|
socket.on('on_asset_hidden', _handleOnAssetHidden);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class FileMediaRepository {
|
|||||||
type: AssetType.image,
|
type: AssetType.image,
|
||||||
createdAt: entity.createDateTime,
|
createdAt: entity.createDateTime,
|
||||||
updatedAt: entity.modifiedDateTime,
|
updatedAt: entity.modifiedDateTime,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+2
@@ -560,6 +560,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SyncAlbumUserV1](doc//SyncAlbumUserV1.md)
|
- [SyncAlbumUserV1](doc//SyncAlbumUserV1.md)
|
||||||
- [SyncAlbumV1](doc//SyncAlbumV1.md)
|
- [SyncAlbumV1](doc//SyncAlbumV1.md)
|
||||||
- [SyncAssetDeleteV1](doc//SyncAssetDeleteV1.md)
|
- [SyncAssetDeleteV1](doc//SyncAssetDeleteV1.md)
|
||||||
|
- [SyncAssetEditDeleteV1](doc//SyncAssetEditDeleteV1.md)
|
||||||
|
- [SyncAssetEditV1](doc//SyncAssetEditV1.md)
|
||||||
- [SyncAssetExifV1](doc//SyncAssetExifV1.md)
|
- [SyncAssetExifV1](doc//SyncAssetExifV1.md)
|
||||||
- [SyncAssetFaceDeleteV1](doc//SyncAssetFaceDeleteV1.md)
|
- [SyncAssetFaceDeleteV1](doc//SyncAssetFaceDeleteV1.md)
|
||||||
- [SyncAssetFaceV1](doc//SyncAssetFaceV1.md)
|
- [SyncAssetFaceV1](doc//SyncAssetFaceV1.md)
|
||||||
|
|||||||
Generated
+2
@@ -306,6 +306,8 @@ part 'model/sync_album_user_delete_v1.dart';
|
|||||||
part 'model/sync_album_user_v1.dart';
|
part 'model/sync_album_user_v1.dart';
|
||||||
part 'model/sync_album_v1.dart';
|
part 'model/sync_album_v1.dart';
|
||||||
part 'model/sync_asset_delete_v1.dart';
|
part 'model/sync_asset_delete_v1.dart';
|
||||||
|
part 'model/sync_asset_edit_delete_v1.dart';
|
||||||
|
part 'model/sync_asset_edit_v1.dart';
|
||||||
part 'model/sync_asset_exif_v1.dart';
|
part 'model/sync_asset_exif_v1.dart';
|
||||||
part 'model/sync_asset_face_delete_v1.dart';
|
part 'model/sync_asset_face_delete_v1.dart';
|
||||||
part 'model/sync_asset_face_v1.dart';
|
part 'model/sync_asset_face_v1.dart';
|
||||||
|
|||||||
Generated
+4
@@ -660,6 +660,10 @@ class ApiClient {
|
|||||||
return SyncAlbumV1.fromJson(value);
|
return SyncAlbumV1.fromJson(value);
|
||||||
case 'SyncAssetDeleteV1':
|
case 'SyncAssetDeleteV1':
|
||||||
return SyncAssetDeleteV1.fromJson(value);
|
return SyncAssetDeleteV1.fromJson(value);
|
||||||
|
case 'SyncAssetEditDeleteV1':
|
||||||
|
return SyncAssetEditDeleteV1.fromJson(value);
|
||||||
|
case 'SyncAssetEditV1':
|
||||||
|
return SyncAssetEditV1.fromJson(value);
|
||||||
case 'SyncAssetExifV1':
|
case 'SyncAssetExifV1':
|
||||||
return SyncAssetExifV1.fromJson(value);
|
return SyncAssetExifV1.fromJson(value);
|
||||||
case 'SyncAssetFaceDeleteV1':
|
case 'SyncAssetFaceDeleteV1':
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class SyncAssetEditDeleteV1 {
|
||||||
|
/// Returns a new [SyncAssetEditDeleteV1] instance.
|
||||||
|
SyncAssetEditDeleteV1({
|
||||||
|
required this.assetId,
|
||||||
|
});
|
||||||
|
|
||||||
|
String assetId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is SyncAssetEditDeleteV1 &&
|
||||||
|
other.assetId == assetId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(assetId.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'SyncAssetEditDeleteV1[assetId=$assetId]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'assetId'] = this.assetId;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [SyncAssetEditDeleteV1] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static SyncAssetEditDeleteV1? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "SyncAssetEditDeleteV1");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return SyncAssetEditDeleteV1(
|
||||||
|
assetId: mapValueOfType<String>(json, r'assetId')!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<SyncAssetEditDeleteV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <SyncAssetEditDeleteV1>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = SyncAssetEditDeleteV1.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, SyncAssetEditDeleteV1> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, SyncAssetEditDeleteV1>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = SyncAssetEditDeleteV1.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of SyncAssetEditDeleteV1-objects as value to a dart map
|
||||||
|
static Map<String, List<SyncAssetEditDeleteV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<SyncAssetEditDeleteV1>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = SyncAssetEditDeleteV1.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'assetId',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
+123
@@ -0,0 +1,123 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class SyncAssetEditV1 {
|
||||||
|
/// Returns a new [SyncAssetEditV1] instance.
|
||||||
|
SyncAssetEditV1({
|
||||||
|
required this.action,
|
||||||
|
required this.assetId,
|
||||||
|
required this.id,
|
||||||
|
required this.parameters,
|
||||||
|
});
|
||||||
|
|
||||||
|
AssetEditAction action;
|
||||||
|
|
||||||
|
String assetId;
|
||||||
|
|
||||||
|
String id;
|
||||||
|
|
||||||
|
Object parameters;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is SyncAssetEditV1 &&
|
||||||
|
other.action == action &&
|
||||||
|
other.assetId == assetId &&
|
||||||
|
other.id == id &&
|
||||||
|
other.parameters == parameters;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(action.hashCode) +
|
||||||
|
(assetId.hashCode) +
|
||||||
|
(id.hashCode) +
|
||||||
|
(parameters.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'SyncAssetEditV1[action=$action, assetId=$assetId, id=$id, parameters=$parameters]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'action'] = this.action;
|
||||||
|
json[r'assetId'] = this.assetId;
|
||||||
|
json[r'id'] = this.id;
|
||||||
|
json[r'parameters'] = this.parameters;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [SyncAssetEditV1] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static SyncAssetEditV1? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "SyncAssetEditV1");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return SyncAssetEditV1(
|
||||||
|
action: AssetEditAction.fromJson(json[r'action'])!,
|
||||||
|
assetId: mapValueOfType<String>(json, r'assetId')!,
|
||||||
|
id: mapValueOfType<String>(json, r'id')!,
|
||||||
|
parameters: mapValueOfType<Object>(json, r'parameters')!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<SyncAssetEditV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <SyncAssetEditV1>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = SyncAssetEditV1.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, SyncAssetEditV1> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, SyncAssetEditV1>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = SyncAssetEditV1.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of SyncAssetEditV1-objects as value to a dart map
|
||||||
|
static Map<String, List<SyncAssetEditV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<SyncAssetEditV1>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = SyncAssetEditV1.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'action',
|
||||||
|
'assetId',
|
||||||
|
'id',
|
||||||
|
'parameters',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
+6
@@ -28,6 +28,8 @@ class SyncEntityType {
|
|||||||
static const userDeleteV1 = SyncEntityType._(r'UserDeleteV1');
|
static const userDeleteV1 = SyncEntityType._(r'UserDeleteV1');
|
||||||
static const assetV1 = SyncEntityType._(r'AssetV1');
|
static const assetV1 = SyncEntityType._(r'AssetV1');
|
||||||
static const assetDeleteV1 = SyncEntityType._(r'AssetDeleteV1');
|
static const assetDeleteV1 = SyncEntityType._(r'AssetDeleteV1');
|
||||||
|
static const assetEditV1 = SyncEntityType._(r'AssetEditV1');
|
||||||
|
static const assetEditDeleteV1 = SyncEntityType._(r'AssetEditDeleteV1');
|
||||||
static const assetExifV1 = SyncEntityType._(r'AssetExifV1');
|
static const assetExifV1 = SyncEntityType._(r'AssetExifV1');
|
||||||
static const assetMetadataV1 = SyncEntityType._(r'AssetMetadataV1');
|
static const assetMetadataV1 = SyncEntityType._(r'AssetMetadataV1');
|
||||||
static const assetMetadataDeleteV1 = SyncEntityType._(r'AssetMetadataDeleteV1');
|
static const assetMetadataDeleteV1 = SyncEntityType._(r'AssetMetadataDeleteV1');
|
||||||
@@ -78,6 +80,8 @@ class SyncEntityType {
|
|||||||
userDeleteV1,
|
userDeleteV1,
|
||||||
assetV1,
|
assetV1,
|
||||||
assetDeleteV1,
|
assetDeleteV1,
|
||||||
|
assetEditV1,
|
||||||
|
assetEditDeleteV1,
|
||||||
assetExifV1,
|
assetExifV1,
|
||||||
assetMetadataV1,
|
assetMetadataV1,
|
||||||
assetMetadataDeleteV1,
|
assetMetadataDeleteV1,
|
||||||
@@ -163,6 +167,8 @@ class SyncEntityTypeTypeTransformer {
|
|||||||
case r'UserDeleteV1': return SyncEntityType.userDeleteV1;
|
case r'UserDeleteV1': return SyncEntityType.userDeleteV1;
|
||||||
case r'AssetV1': return SyncEntityType.assetV1;
|
case r'AssetV1': return SyncEntityType.assetV1;
|
||||||
case r'AssetDeleteV1': return SyncEntityType.assetDeleteV1;
|
case r'AssetDeleteV1': return SyncEntityType.assetDeleteV1;
|
||||||
|
case r'AssetEditV1': return SyncEntityType.assetEditV1;
|
||||||
|
case r'AssetEditDeleteV1': return SyncEntityType.assetEditDeleteV1;
|
||||||
case r'AssetExifV1': return SyncEntityType.assetExifV1;
|
case r'AssetExifV1': return SyncEntityType.assetExifV1;
|
||||||
case r'AssetMetadataV1': return SyncEntityType.assetMetadataV1;
|
case r'AssetMetadataV1': return SyncEntityType.assetMetadataV1;
|
||||||
case r'AssetMetadataDeleteV1': return SyncEntityType.assetMetadataDeleteV1;
|
case r'AssetMetadataDeleteV1': return SyncEntityType.assetMetadataDeleteV1;
|
||||||
|
|||||||
+3
@@ -29,6 +29,7 @@ class SyncRequestType {
|
|||||||
static const albumAssetsV1 = SyncRequestType._(r'AlbumAssetsV1');
|
static const albumAssetsV1 = SyncRequestType._(r'AlbumAssetsV1');
|
||||||
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
|
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
|
||||||
static const assetsV1 = SyncRequestType._(r'AssetsV1');
|
static const assetsV1 = SyncRequestType._(r'AssetsV1');
|
||||||
|
static const assetEditsV1 = SyncRequestType._(r'AssetEditsV1');
|
||||||
static const assetExifsV1 = SyncRequestType._(r'AssetExifsV1');
|
static const assetExifsV1 = SyncRequestType._(r'AssetExifsV1');
|
||||||
static const assetMetadataV1 = SyncRequestType._(r'AssetMetadataV1');
|
static const assetMetadataV1 = SyncRequestType._(r'AssetMetadataV1');
|
||||||
static const authUsersV1 = SyncRequestType._(r'AuthUsersV1');
|
static const authUsersV1 = SyncRequestType._(r'AuthUsersV1');
|
||||||
@@ -52,6 +53,7 @@ class SyncRequestType {
|
|||||||
albumAssetsV1,
|
albumAssetsV1,
|
||||||
albumAssetExifsV1,
|
albumAssetExifsV1,
|
||||||
assetsV1,
|
assetsV1,
|
||||||
|
assetEditsV1,
|
||||||
assetExifsV1,
|
assetExifsV1,
|
||||||
assetMetadataV1,
|
assetMetadataV1,
|
||||||
authUsersV1,
|
authUsersV1,
|
||||||
@@ -110,6 +112,7 @@ class SyncRequestTypeTypeTransformer {
|
|||||||
case r'AlbumAssetsV1': return SyncRequestType.albumAssetsV1;
|
case r'AlbumAssetsV1': return SyncRequestType.albumAssetsV1;
|
||||||
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
|
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
|
||||||
case r'AssetsV1': return SyncRequestType.assetsV1;
|
case r'AssetsV1': return SyncRequestType.assetsV1;
|
||||||
|
case r'AssetEditsV1': return SyncRequestType.assetEditsV1;
|
||||||
case r'AssetExifsV1': return SyncRequestType.assetExifsV1;
|
case r'AssetExifsV1': return SyncRequestType.assetExifsV1;
|
||||||
case r'AssetMetadataV1': return SyncRequestType.assetMetadataV1;
|
case r'AssetMetadataV1': return SyncRequestType.assetMetadataV1;
|
||||||
case r'AuthUsersV1': return SyncRequestType.authUsersV1;
|
case r'AuthUsersV1': return SyncRequestType.authUsersV1;
|
||||||
|
|||||||
+4
@@ -19,6 +19,7 @@ import 'schema_v13.dart' as v13;
|
|||||||
import 'schema_v14.dart' as v14;
|
import 'schema_v14.dart' as v14;
|
||||||
import 'schema_v15.dart' as v15;
|
import 'schema_v15.dart' as v15;
|
||||||
import 'schema_v16.dart' as v16;
|
import 'schema_v16.dart' as v16;
|
||||||
|
import 'schema_v17.dart' as v17;
|
||||||
|
|
||||||
class GeneratedHelper implements SchemaInstantiationHelper {
|
class GeneratedHelper implements SchemaInstantiationHelper {
|
||||||
@override
|
@override
|
||||||
@@ -56,6 +57,8 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
|||||||
return v15.DatabaseAtV15(db);
|
return v15.DatabaseAtV15(db);
|
||||||
case 16:
|
case 16:
|
||||||
return v16.DatabaseAtV16(db);
|
return v16.DatabaseAtV16(db);
|
||||||
|
case 17:
|
||||||
|
return v17.DatabaseAtV17(db);
|
||||||
default:
|
default:
|
||||||
throw MissingSchemaException(version, versions);
|
throw MissingSchemaException(version, versions);
|
||||||
}
|
}
|
||||||
@@ -78,5 +81,6 @@ class GeneratedHelper implements SchemaInstantiationHelper {
|
|||||||
14,
|
14,
|
||||||
15,
|
15,
|
||||||
16,
|
16,
|
||||||
|
17,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
+8551
File diff suppressed because it is too large
Load Diff
Vendored
+2
@@ -64,6 +64,7 @@ abstract final class LocalAssetStub {
|
|||||||
type: AssetType.image,
|
type: AssetType.image,
|
||||||
createdAt: DateTime(2025),
|
createdAt: DateTime(2025),
|
||||||
updatedAt: DateTime(2025, 2),
|
updatedAt: DateTime(2025, 2),
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
static final image2 = LocalAsset(
|
static final image2 = LocalAsset(
|
||||||
@@ -72,5 +73,6 @@ abstract final class LocalAssetStub {
|
|||||||
type: AssetType.image,
|
type: AssetType.image,
|
||||||
createdAt: DateTime(2000),
|
createdAt: DateTime(2000),
|
||||||
updatedAt: DateTime(20021),
|
updatedAt: DateTime(20021),
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ void main() {
|
|||||||
latitude: 37.7749,
|
latitude: 37.7749,
|
||||||
longitude: -122.4194,
|
longitude: -122.4194,
|
||||||
adjustmentTime: DateTime(2026, 1, 2),
|
adjustmentTime: DateTime(2026, 1, 2),
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final mockEntity = MockAssetEntity();
|
final mockEntity = MockAssetEntity();
|
||||||
@@ -274,6 +275,7 @@ void main() {
|
|||||||
cloudId: 'cloud-id-123',
|
cloudId: 'cloud-id-123',
|
||||||
latitude: 37.7749,
|
latitude: 37.7749,
|
||||||
longitude: -122.4194,
|
longitude: -122.4194,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final mockEntity = MockAssetEntity();
|
final mockEntity = MockAssetEntity();
|
||||||
@@ -314,6 +316,7 @@ void main() {
|
|||||||
cloudId: 'cloud-id-123',
|
cloudId: 'cloud-id-123',
|
||||||
latitude: 37.7749,
|
latitude: 37.7749,
|
||||||
longitude: -122.4194,
|
longitude: -122.4194,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final mockEntity = MockAssetEntity();
|
final mockEntity = MockAssetEntity();
|
||||||
@@ -352,6 +355,7 @@ void main() {
|
|||||||
createdAt: DateTime(2025, 1, 1),
|
createdAt: DateTime(2025, 1, 1),
|
||||||
updatedAt: DateTime(2025, 1, 2),
|
updatedAt: DateTime(2025, 1, 2),
|
||||||
cloudId: null, // No cloudId
|
cloudId: null, // No cloudId
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final mockEntity = MockAssetEntity();
|
final mockEntity = MockAssetEntity();
|
||||||
@@ -394,6 +398,7 @@ void main() {
|
|||||||
cloudId: 'cloud-id-livephoto',
|
cloudId: 'cloud-id-livephoto',
|
||||||
latitude: 37.7749,
|
latitude: 37.7749,
|
||||||
longitude: -122.4194,
|
longitude: -122.4194,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final mockEntity = MockAssetEntity();
|
final mockEntity = MockAssetEntity();
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ abstract final class TestUtils {
|
|||||||
isFavorite: false,
|
isFavorite: false,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,6 +155,7 @@ abstract final class TestUtils {
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
orientation: orientation,
|
orientation: orientation,
|
||||||
|
isEdited: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class MediumFactory {
|
|||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
String? checksum,
|
String? checksum,
|
||||||
|
bool? isEdited,
|
||||||
}) {
|
}) {
|
||||||
final random = Random();
|
final random = Random();
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ class MediumFactory {
|
|||||||
type: type ?? AssetType.image,
|
type: type ?? AssetType.image,
|
||||||
createdAt: createdAt ?? DateTime.fromMillisecondsSinceEpoch(random.nextInt(1000000000)),
|
createdAt: createdAt ?? DateTime.fromMillisecondsSinceEpoch(random.nextInt(1000000000)),
|
||||||
updatedAt: updatedAt ?? DateTime.fromMillisecondsSinceEpoch(random.nextInt(1000000000)),
|
updatedAt: updatedAt ?? DateTime.fromMillisecondsSinceEpoch(random.nextInt(1000000000)),
|
||||||
|
isEdited: isEdited ?? false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ LocalAsset createLocalAsset({
|
|||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
bool isFavorite = false,
|
bool isFavorite = false,
|
||||||
|
bool isEdited = false,
|
||||||
}) {
|
}) {
|
||||||
return LocalAsset(
|
return LocalAsset(
|
||||||
id: 'local-id',
|
id: 'local-id',
|
||||||
@@ -23,6 +24,7 @@ LocalAsset createLocalAsset({
|
|||||||
createdAt: createdAt ?? DateTime.now(),
|
createdAt: createdAt ?? DateTime.now(),
|
||||||
updatedAt: updatedAt ?? DateTime.now(),
|
updatedAt: updatedAt ?? DateTime.now(),
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
|
isEdited: isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ RemoteAsset createRemoteAsset({
|
|||||||
DateTime? createdAt,
|
DateTime? createdAt,
|
||||||
DateTime? updatedAt,
|
DateTime? updatedAt,
|
||||||
bool isFavorite = false,
|
bool isFavorite = false,
|
||||||
|
bool isEdited = false,
|
||||||
}) {
|
}) {
|
||||||
return RemoteAsset(
|
return RemoteAsset(
|
||||||
id: 'remote-id',
|
id: 'remote-id',
|
||||||
@@ -45,6 +48,7 @@ RemoteAsset createRemoteAsset({
|
|||||||
createdAt: createdAt ?? DateTime.now(),
|
createdAt: createdAt ?? DateTime.now(),
|
||||||
updatedAt: updatedAt ?? DateTime.now(),
|
updatedAt: updatedAt ?? DateTime.now(),
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
|
isEdited: isEdited,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21031,6 +21031,44 @@
|
|||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"SyncAssetEditDeleteV1": {
|
||||||
|
"properties": {
|
||||||
|
"assetId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"assetId"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"SyncAssetEditV1": {
|
||||||
|
"properties": {
|
||||||
|
"action": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/schemas/AssetEditAction"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"assetId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"action",
|
||||||
|
"assetId",
|
||||||
|
"id",
|
||||||
|
"parameters"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"SyncAssetExifV1": {
|
"SyncAssetExifV1": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"assetId": {
|
"assetId": {
|
||||||
@@ -21445,6 +21483,8 @@
|
|||||||
"UserDeleteV1",
|
"UserDeleteV1",
|
||||||
"AssetV1",
|
"AssetV1",
|
||||||
"AssetDeleteV1",
|
"AssetDeleteV1",
|
||||||
|
"AssetEditV1",
|
||||||
|
"AssetEditDeleteV1",
|
||||||
"AssetExifV1",
|
"AssetExifV1",
|
||||||
"AssetMetadataV1",
|
"AssetMetadataV1",
|
||||||
"AssetMetadataDeleteV1",
|
"AssetMetadataDeleteV1",
|
||||||
@@ -21707,6 +21747,7 @@
|
|||||||
"AlbumAssetsV1",
|
"AlbumAssetsV1",
|
||||||
"AlbumAssetExifsV1",
|
"AlbumAssetExifsV1",
|
||||||
"AssetsV1",
|
"AssetsV1",
|
||||||
|
"AssetEditsV1",
|
||||||
"AssetExifsV1",
|
"AssetExifsV1",
|
||||||
"AssetMetadataV1",
|
"AssetMetadataV1",
|
||||||
"AuthUsersV1",
|
"AuthUsersV1",
|
||||||
|
|||||||
@@ -5683,6 +5683,8 @@ export enum SyncEntityType {
|
|||||||
UserDeleteV1 = "UserDeleteV1",
|
UserDeleteV1 = "UserDeleteV1",
|
||||||
AssetV1 = "AssetV1",
|
AssetV1 = "AssetV1",
|
||||||
AssetDeleteV1 = "AssetDeleteV1",
|
AssetDeleteV1 = "AssetDeleteV1",
|
||||||
|
AssetEditV1 = "AssetEditV1",
|
||||||
|
AssetEditDeleteV1 = "AssetEditDeleteV1",
|
||||||
AssetExifV1 = "AssetExifV1",
|
AssetExifV1 = "AssetExifV1",
|
||||||
AssetMetadataV1 = "AssetMetadataV1",
|
AssetMetadataV1 = "AssetMetadataV1",
|
||||||
AssetMetadataDeleteV1 = "AssetMetadataDeleteV1",
|
AssetMetadataDeleteV1 = "AssetMetadataDeleteV1",
|
||||||
@@ -5733,6 +5735,7 @@ export enum SyncRequestType {
|
|||||||
AlbumAssetsV1 = "AlbumAssetsV1",
|
AlbumAssetsV1 = "AlbumAssetsV1",
|
||||||
AlbumAssetExifsV1 = "AlbumAssetExifsV1",
|
AlbumAssetExifsV1 = "AlbumAssetExifsV1",
|
||||||
AssetsV1 = "AssetsV1",
|
AssetsV1 = "AssetsV1",
|
||||||
|
AssetEditsV1 = "AssetEditsV1",
|
||||||
AssetExifsV1 = "AssetExifsV1",
|
AssetExifsV1 = "AssetExifsV1",
|
||||||
AssetMetadataV1 = "AssetMetadataV1",
|
AssetMetadataV1 = "AssetMetadataV1",
|
||||||
AuthUsersV1 = "AuthUsersV1",
|
AuthUsersV1 = "AuthUsersV1",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { ArrayMaxSize, IsInt, IsPositive, IsString } from 'class-validator';
|
import { ArrayMaxSize, IsInt, IsPositive, IsString } from 'class-validator';
|
||||||
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
|
||||||
|
import { AssetEditAction, AssetEditActionParameter } from 'src/dtos/editing.dto';
|
||||||
import {
|
import {
|
||||||
AlbumUserRole,
|
AlbumUserRole,
|
||||||
AssetOrder,
|
AssetOrder,
|
||||||
@@ -128,6 +129,20 @@ export class SyncAssetDeleteV1 {
|
|||||||
assetId!: string;
|
assetId!: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExtraModel()
|
||||||
|
export class SyncAssetEditV1 {
|
||||||
|
id!: string;
|
||||||
|
assetId!: string;
|
||||||
|
@ValidateEnum({ enum: AssetEditAction, name: 'AssetEditAction' })
|
||||||
|
action!: AssetEditAction;
|
||||||
|
parameters!: AssetEditActionParameter[AssetEditAction];
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExtraModel()
|
||||||
|
export class SyncAssetEditDeleteV1 {
|
||||||
|
assetId!: string;
|
||||||
|
}
|
||||||
|
|
||||||
@ExtraModel()
|
@ExtraModel()
|
||||||
export class SyncAssetExifV1 {
|
export class SyncAssetExifV1 {
|
||||||
assetId!: string;
|
assetId!: string;
|
||||||
@@ -349,6 +364,8 @@ export type SyncItem = {
|
|||||||
[SyncEntityType.PartnerDeleteV1]: SyncPartnerDeleteV1;
|
[SyncEntityType.PartnerDeleteV1]: SyncPartnerDeleteV1;
|
||||||
[SyncEntityType.AssetV1]: SyncAssetV1;
|
[SyncEntityType.AssetV1]: SyncAssetV1;
|
||||||
[SyncEntityType.AssetDeleteV1]: SyncAssetDeleteV1;
|
[SyncEntityType.AssetDeleteV1]: SyncAssetDeleteV1;
|
||||||
|
[SyncEntityType.AssetEditV1]: SyncAssetEditV1;
|
||||||
|
[SyncEntityType.AssetEditDeleteV1]: SyncAssetEditDeleteV1;
|
||||||
[SyncEntityType.AssetMetadataV1]: SyncAssetMetadataV1;
|
[SyncEntityType.AssetMetadataV1]: SyncAssetMetadataV1;
|
||||||
[SyncEntityType.AssetMetadataDeleteV1]: SyncAssetMetadataDeleteV1;
|
[SyncEntityType.AssetMetadataDeleteV1]: SyncAssetMetadataDeleteV1;
|
||||||
[SyncEntityType.AssetExifV1]: SyncAssetExifV1;
|
[SyncEntityType.AssetExifV1]: SyncAssetExifV1;
|
||||||
|
|||||||
@@ -716,6 +716,7 @@ export enum SyncRequestType {
|
|||||||
AlbumAssetsV1 = 'AlbumAssetsV1',
|
AlbumAssetsV1 = 'AlbumAssetsV1',
|
||||||
AlbumAssetExifsV1 = 'AlbumAssetExifsV1',
|
AlbumAssetExifsV1 = 'AlbumAssetExifsV1',
|
||||||
AssetsV1 = 'AssetsV1',
|
AssetsV1 = 'AssetsV1',
|
||||||
|
AssetEditsV1 = 'AssetEditsV1',
|
||||||
AssetExifsV1 = 'AssetExifsV1',
|
AssetExifsV1 = 'AssetExifsV1',
|
||||||
AssetMetadataV1 = 'AssetMetadataV1',
|
AssetMetadataV1 = 'AssetMetadataV1',
|
||||||
AuthUsersV1 = 'AuthUsersV1',
|
AuthUsersV1 = 'AuthUsersV1',
|
||||||
@@ -740,6 +741,8 @@ export enum SyncEntityType {
|
|||||||
|
|
||||||
AssetV1 = 'AssetV1',
|
AssetV1 = 'AssetV1',
|
||||||
AssetDeleteV1 = 'AssetDeleteV1',
|
AssetDeleteV1 = 'AssetDeleteV1',
|
||||||
|
AssetEditV1 = 'AssetEditV1',
|
||||||
|
AssetEditDeleteV1 = 'AssetEditDeleteV1',
|
||||||
AssetExifV1 = 'AssetExifV1',
|
AssetExifV1 = 'AssetExifV1',
|
||||||
AssetMetadataV1 = 'AssetMetadataV1',
|
AssetMetadataV1 = 'AssetMetadataV1',
|
||||||
AssetMetadataDeleteV1 = 'AssetMetadataDeleteV1',
|
AssetMetadataDeleteV1 = 'AssetMetadataDeleteV1',
|
||||||
|
|||||||
@@ -466,6 +466,37 @@ where
|
|||||||
order by
|
order by
|
||||||
"asset"."updateId" asc
|
"asset"."updateId" asc
|
||||||
|
|
||||||
|
-- SyncRepository.assetEdit.getDeletes
|
||||||
|
select
|
||||||
|
"asset_edit_audit"."id",
|
||||||
|
"assetId"
|
||||||
|
from
|
||||||
|
"asset_edit_audit" as "asset_edit_audit"
|
||||||
|
left join "asset" on "asset"."id" = "asset_edit_audit"."assetId"
|
||||||
|
where
|
||||||
|
"asset_edit_audit"."id" < $1
|
||||||
|
and "asset_edit_audit"."id" > $2
|
||||||
|
and "asset"."ownerId" = $3
|
||||||
|
order by
|
||||||
|
"asset_edit_audit"."id" asc
|
||||||
|
|
||||||
|
-- SyncRepository.assetEdit.getUpserts
|
||||||
|
select
|
||||||
|
"asset_edit"."id",
|
||||||
|
"assetId",
|
||||||
|
"action",
|
||||||
|
"parameters",
|
||||||
|
"asset_edit"."updateId"
|
||||||
|
from
|
||||||
|
"asset_edit" as "asset_edit"
|
||||||
|
inner join "asset" on "asset"."id" = "asset_edit"."assetId"
|
||||||
|
where
|
||||||
|
"asset_edit"."updateId" < $1
|
||||||
|
and "asset_edit"."updateId" > $2
|
||||||
|
and "asset"."ownerId" = $3
|
||||||
|
order by
|
||||||
|
"asset_edit"."updateId" asc
|
||||||
|
|
||||||
-- SyncRepository.assetExif.getUpserts
|
-- SyncRepository.assetExif.getUpserts
|
||||||
select
|
select
|
||||||
"asset_exif"."assetId",
|
"asset_exif"."assetId",
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export class SyncRepository {
|
|||||||
albumToAsset: AlbumToAssetSync;
|
albumToAsset: AlbumToAssetSync;
|
||||||
albumUser: AlbumUserSync;
|
albumUser: AlbumUserSync;
|
||||||
asset: AssetSync;
|
asset: AssetSync;
|
||||||
|
assetEdit: AssetEditSync;
|
||||||
assetExif: AssetExifSync;
|
assetExif: AssetExifSync;
|
||||||
assetFace: AssetFaceSync;
|
assetFace: AssetFaceSync;
|
||||||
assetMetadata: AssetMetadataSync;
|
assetMetadata: AssetMetadataSync;
|
||||||
@@ -74,6 +75,7 @@ export class SyncRepository {
|
|||||||
this.albumToAsset = new AlbumToAssetSync(this.db);
|
this.albumToAsset = new AlbumToAssetSync(this.db);
|
||||||
this.albumUser = new AlbumUserSync(this.db);
|
this.albumUser = new AlbumUserSync(this.db);
|
||||||
this.asset = new AssetSync(this.db);
|
this.asset = new AssetSync(this.db);
|
||||||
|
this.assetEdit = new AssetEditSync(this.db);
|
||||||
this.assetExif = new AssetExifSync(this.db);
|
this.assetExif = new AssetExifSync(this.db);
|
||||||
this.assetFace = new AssetFaceSync(this.db);
|
this.assetFace = new AssetFaceSync(this.db);
|
||||||
this.assetMetadata = new AssetMetadataSync(this.db);
|
this.assetMetadata = new AssetMetadataSync(this.db);
|
||||||
@@ -770,3 +772,27 @@ class AssetMetadataSync extends BaseSync {
|
|||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AssetEditSync extends BaseSync {
|
||||||
|
@GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
|
||||||
|
getDeletes(options: SyncQueryOptions) {
|
||||||
|
return this.auditQuery('asset_edit_audit', options)
|
||||||
|
.select(['asset_edit_audit.id', 'assetId'])
|
||||||
|
.leftJoin('asset', 'asset.id', 'asset_edit_audit.assetId')
|
||||||
|
.where('asset.ownerId', '=', options.userId)
|
||||||
|
.stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanupAuditTable(daysAgo: number) {
|
||||||
|
return this.auditCleanup('asset_edit_audit', daysAgo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GenerateSql({ params: [dummyQueryOptions, DummyValue.UUID], stream: true })
|
||||||
|
getUpserts(options: SyncQueryOptions) {
|
||||||
|
return this.upsertQuery('asset_edit', options)
|
||||||
|
.select(['asset_edit.id', 'assetId', 'action', 'parameters', 'asset_edit.updateId'])
|
||||||
|
.innerJoin('asset', 'asset.id', 'asset_edit.assetId')
|
||||||
|
.where('asset.ownerId', '=', options.userId)
|
||||||
|
.stream();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -255,3 +255,16 @@ export const asset_face_audit = registerFunction({
|
|||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
END`,
|
END`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const asset_edit_audit = registerFunction({
|
||||||
|
name: 'asset_edit_audit',
|
||||||
|
returnType: 'TRIGGER',
|
||||||
|
language: 'PLPGSQL',
|
||||||
|
body: `
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO asset_edit_audit ("assetId")
|
||||||
|
SELECT "assetId"
|
||||||
|
FROM OLD;
|
||||||
|
RETURN NULL;
|
||||||
|
END`,
|
||||||
|
});
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { AlbumUserTable } from 'src/schema/tables/album-user.table';
|
|||||||
import { AlbumTable } from 'src/schema/tables/album.table';
|
import { AlbumTable } from 'src/schema/tables/album.table';
|
||||||
import { ApiKeyTable } from 'src/schema/tables/api-key.table';
|
import { ApiKeyTable } from 'src/schema/tables/api-key.table';
|
||||||
import { AssetAuditTable } from 'src/schema/tables/asset-audit.table';
|
import { AssetAuditTable } from 'src/schema/tables/asset-audit.table';
|
||||||
|
import { AssetEditAuditTable } from 'src/schema/tables/asset-edit-audit.table';
|
||||||
import { AssetEditTable } from 'src/schema/tables/asset-edit.table';
|
import { AssetEditTable } from 'src/schema/tables/asset-edit.table';
|
||||||
import { AssetExifTable } from 'src/schema/tables/asset-exif.table';
|
import { AssetExifTable } from 'src/schema/tables/asset-exif.table';
|
||||||
import { AssetFaceAuditTable } from 'src/schema/tables/asset-face-audit.table';
|
import { AssetFaceAuditTable } from 'src/schema/tables/asset-face-audit.table';
|
||||||
@@ -88,6 +89,7 @@ export class ImmichDatabase {
|
|||||||
ApiKeyTable,
|
ApiKeyTable,
|
||||||
AssetAuditTable,
|
AssetAuditTable,
|
||||||
AssetEditTable,
|
AssetEditTable,
|
||||||
|
AssetEditAuditTable,
|
||||||
AssetFaceTable,
|
AssetFaceTable,
|
||||||
AssetFaceAuditTable,
|
AssetFaceAuditTable,
|
||||||
AssetMetadataTable,
|
AssetMetadataTable,
|
||||||
@@ -182,6 +184,7 @@ export interface DB {
|
|||||||
asset: AssetTable;
|
asset: AssetTable;
|
||||||
asset_audit: AssetAuditTable;
|
asset_audit: AssetAuditTable;
|
||||||
asset_edit: AssetEditTable;
|
asset_edit: AssetEditTable;
|
||||||
|
asset_edit_audit: AssetEditAuditTable;
|
||||||
asset_exif: AssetExifTable;
|
asset_exif: AssetExifTable;
|
||||||
asset_face: AssetFaceTable;
|
asset_face: AssetFaceTable;
|
||||||
asset_face_audit: AssetFaceAuditTable;
|
asset_face_audit: AssetFaceAuditTable;
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
|
await sql`CREATE OR REPLACE FUNCTION asset_edit_audit()
|
||||||
|
RETURNS TRIGGER
|
||||||
|
LANGUAGE PLPGSQL
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO asset_edit_audit ("assetId")
|
||||||
|
SELECT "assetId"
|
||||||
|
FROM OLD;
|
||||||
|
RETURN NULL;
|
||||||
|
END
|
||||||
|
$$;`.execute(db);
|
||||||
|
await sql`CREATE TABLE "asset_edit_audit" (
|
||||||
|
"id" uuid NOT NULL DEFAULT immich_uuid_v7(),
|
||||||
|
"assetId" uuid NOT NULL,
|
||||||
|
"deletedAt" timestamp with time zone NOT NULL DEFAULT clock_timestamp(),
|
||||||
|
CONSTRAINT "asset_edit_audit_pkey" PRIMARY KEY ("id")
|
||||||
|
);`.execute(db);
|
||||||
|
await sql`CREATE INDEX "asset_edit_audit_assetId_idx" ON "asset_edit_audit" ("assetId");`.execute(db);
|
||||||
|
await sql`CREATE INDEX "asset_edit_audit_deletedAt_idx" ON "asset_edit_audit" ("deletedAt");`.execute(db);
|
||||||
|
await sql`ALTER TABLE "asset_edit" ADD "updateId" uuid NOT NULL DEFAULT immich_uuid_v7();`.execute(db);
|
||||||
|
await sql`CREATE INDEX "asset_edit_updateId_idx" ON "asset_edit" ("updateId");`.execute(db);
|
||||||
|
await sql`CREATE OR REPLACE TRIGGER "asset_edit_audit"
|
||||||
|
AFTER DELETE ON "asset_edit"
|
||||||
|
REFERENCING OLD TABLE AS "old"
|
||||||
|
FOR EACH STATEMENT
|
||||||
|
WHEN (pg_trigger_depth() = 0)
|
||||||
|
EXECUTE FUNCTION asset_edit_audit();`.execute(db);
|
||||||
|
await sql`INSERT INTO "migration_overrides" ("name", "value") VALUES ('function_asset_edit_audit', '{"type":"function","name":"asset_edit_audit","sql":"CREATE OR REPLACE FUNCTION asset_edit_audit()\\n RETURNS TRIGGER\\n LANGUAGE PLPGSQL\\n AS $$\\n BEGIN\\n INSERT INTO asset_edit_audit (\\"assetId\\")\\n SELECT \\"assetId\\"\\n FROM OLD;\\n RETURN NULL;\\n END\\n $$;"}'::jsonb);`.execute(db);
|
||||||
|
await sql`INSERT INTO "migration_overrides" ("name", "value") VALUES ('trigger_asset_edit_audit', '{"type":"trigger","name":"asset_edit_audit","sql":"CREATE OR REPLACE TRIGGER \\"asset_edit_audit\\"\\n AFTER DELETE ON \\"asset_edit\\"\\n REFERENCING OLD TABLE AS \\"old\\"\\n FOR EACH STATEMENT\\n WHEN (pg_trigger_depth() = 0)\\n EXECUTE FUNCTION asset_edit_audit();"}'::jsonb);`.execute(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await sql`DROP TRIGGER "asset_edit_audit" ON "asset_edit";`.execute(db);
|
||||||
|
await sql`DROP INDEX "asset_edit_updateId_idx";`.execute(db);
|
||||||
|
await sql`ALTER TABLE "asset_edit" DROP COLUMN "updateId";`.execute(db);
|
||||||
|
await sql`DROP TABLE "asset_edit_audit";`.execute(db);
|
||||||
|
await sql`DROP FUNCTION asset_edit_audit;`.execute(db);
|
||||||
|
await sql`DELETE FROM "migration_overrides" WHERE "name" = 'function_asset_edit_audit';`.execute(db);
|
||||||
|
await sql`DELETE FROM "migration_overrides" WHERE "name" = 'trigger_asset_edit_audit';`.execute(db);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { PrimaryGeneratedUuidV7Column } from 'src/decorators';
|
||||||
|
import { Column, CreateDateColumn, Generated, Table, Timestamp } from 'src/sql-tools';
|
||||||
|
|
||||||
|
@Table('asset_edit_audit')
|
||||||
|
export class AssetEditAuditTable {
|
||||||
|
@PrimaryGeneratedUuidV7Column()
|
||||||
|
id!: Generated<string>;
|
||||||
|
|
||||||
|
@Column({ type: 'uuid', index: true })
|
||||||
|
assetId!: string;
|
||||||
|
|
||||||
|
@CreateDateColumn({ default: () => 'clock_timestamp()', index: true })
|
||||||
|
deletedAt!: Generated<Timestamp>;
|
||||||
|
}
|
||||||
@@ -1,7 +1,16 @@
|
|||||||
|
import { UpdateIdColumn } from 'src/decorators';
|
||||||
import { AssetEditAction, AssetEditActionParameter } from 'src/dtos/editing.dto';
|
import { AssetEditAction, AssetEditActionParameter } from 'src/dtos/editing.dto';
|
||||||
|
import { asset_edit_audit } from 'src/schema/functions';
|
||||||
import { AssetTable } from 'src/schema/tables/asset.table';
|
import { AssetTable } from 'src/schema/tables/asset.table';
|
||||||
import { Column, ForeignKeyColumn, Generated, PrimaryGeneratedColumn } from 'src/sql-tools';
|
import { AfterDeleteTrigger, Column, ForeignKeyColumn, Generated, PrimaryGeneratedColumn, Table } from 'src/sql-tools';
|
||||||
|
|
||||||
|
@Table('asset_edit')
|
||||||
|
@AfterDeleteTrigger({
|
||||||
|
scope: 'statement',
|
||||||
|
function: asset_edit_audit,
|
||||||
|
referencingOldTableAs: 'old',
|
||||||
|
when: 'pg_trigger_depth() = 0',
|
||||||
|
})
|
||||||
export class AssetEditTable<T extends AssetEditAction = AssetEditAction> {
|
export class AssetEditTable<T extends AssetEditAction = AssetEditAction> {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id!: Generated<string>;
|
id!: Generated<string>;
|
||||||
@@ -14,4 +23,7 @@ export class AssetEditTable<T extends AssetEditAction = AssetEditAction> {
|
|||||||
|
|
||||||
@Column({ type: 'jsonb' })
|
@Column({ type: 'jsonb' })
|
||||||
parameters!: AssetEditActionParameter[T];
|
parameters!: AssetEditActionParameter[T];
|
||||||
|
|
||||||
|
@UpdateIdColumn({ index: true })
|
||||||
|
updateId!: Generated<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export const SYNC_TYPES_ORDER = [
|
|||||||
SyncRequestType.AssetFacesV1,
|
SyncRequestType.AssetFacesV1,
|
||||||
SyncRequestType.UserMetadataV1,
|
SyncRequestType.UserMetadataV1,
|
||||||
SyncRequestType.AssetMetadataV1,
|
SyncRequestType.AssetMetadataV1,
|
||||||
|
SyncRequestType.AssetEditsV1,
|
||||||
];
|
];
|
||||||
|
|
||||||
const throwSessionRequired = () => {
|
const throwSessionRequired = () => {
|
||||||
@@ -172,6 +173,7 @@ export class SyncService extends BaseService {
|
|||||||
[SyncRequestType.UsersV1]: () => this.syncUsersV1(options, response, checkpointMap),
|
[SyncRequestType.UsersV1]: () => this.syncUsersV1(options, response, checkpointMap),
|
||||||
[SyncRequestType.PartnersV1]: () => this.syncPartnersV1(options, response, checkpointMap),
|
[SyncRequestType.PartnersV1]: () => this.syncPartnersV1(options, response, checkpointMap),
|
||||||
[SyncRequestType.AssetsV1]: () => this.syncAssetsV1(options, response, checkpointMap),
|
[SyncRequestType.AssetsV1]: () => this.syncAssetsV1(options, response, checkpointMap),
|
||||||
|
[SyncRequestType.AssetEditsV1]: () => this.syncAssetEditsV1(options, response, checkpointMap),
|
||||||
[SyncRequestType.AssetExifsV1]: () => this.syncAssetExifsV1(options, response, checkpointMap),
|
[SyncRequestType.AssetExifsV1]: () => this.syncAssetExifsV1(options, response, checkpointMap),
|
||||||
[SyncRequestType.PartnerAssetsV1]: () => this.syncPartnerAssetsV1(options, response, checkpointMap, session.id),
|
[SyncRequestType.PartnerAssetsV1]: () => this.syncPartnerAssetsV1(options, response, checkpointMap, session.id),
|
||||||
[SyncRequestType.AssetMetadataV1]: () => this.syncAssetMetadataV1(options, response, checkpointMap, auth),
|
[SyncRequestType.AssetMetadataV1]: () => this.syncAssetMetadataV1(options, response, checkpointMap, auth),
|
||||||
@@ -192,8 +194,12 @@ export class SyncService extends BaseService {
|
|||||||
[SyncRequestType.UserMetadataV1]: () => this.syncUserMetadataV1(options, response, checkpointMap),
|
[SyncRequestType.UserMetadataV1]: () => this.syncUserMetadataV1(options, response, checkpointMap),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('dtos types:', dto.types);
|
||||||
|
|
||||||
for (const type of SYNC_TYPES_ORDER.filter((type) => dto.types.includes(type))) {
|
for (const type of SYNC_TYPES_ORDER.filter((type) => dto.types.includes(type))) {
|
||||||
const handler = handlers[type];
|
const handler = handlers[type];
|
||||||
|
console.log('syncing type:', SyncRequestType[type]);
|
||||||
|
console.log('handling with:', handler);
|
||||||
await handler();
|
await handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,6 +843,23 @@ export class SyncService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async syncAssetEditsV1(options: SyncQueryOptions, response: Writable, checkpointMap: CheckpointMap) {
|
||||||
|
console.log('syncing asset edits');
|
||||||
|
const deleteType = SyncEntityType.AssetEditDeleteV1;
|
||||||
|
const deletes = this.syncRepository.assetEdit.getDeletes({ ...options, ack: checkpointMap[deleteType] });
|
||||||
|
|
||||||
|
for await (const { id, ...data } of deletes) {
|
||||||
|
send(response, { type: deleteType, ids: [id], data });
|
||||||
|
}
|
||||||
|
const upsertType = SyncEntityType.AssetEditV1;
|
||||||
|
const upserts = this.syncRepository.assetEdit.getUpserts({ ...options, ack: checkpointMap[upsertType] });
|
||||||
|
|
||||||
|
for await (const { updateId, ...data } of upserts) {
|
||||||
|
console.log('upsert asset edit', updateId);
|
||||||
|
send(response, { type: upsertType, ids: [updateId], data });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async upsertBackfillCheckpoint(item: { type: SyncEntityType; sessionId: string; createId: string }) {
|
private async upsertBackfillCheckpoint(item: { type: SyncEntityType; sessionId: string; createId: string }) {
|
||||||
const { type, sessionId, createId } = item;
|
const { type, sessionId, createId } = item;
|
||||||
await this.syncCheckpointRepository.upsertAll([
|
await this.syncCheckpointRepository.upsertAll([
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import AddToStackAction from '$lib/components/asset-viewer/actions/add-to-stack-action.svelte';
|
import AddToStackAction from '$lib/components/asset-viewer/actions/add-to-stack-action.svelte';
|
||||||
import ArchiveAction from '$lib/components/asset-viewer/actions/archive-action.svelte';
|
import ArchiveAction from '$lib/components/asset-viewer/actions/archive-action.svelte';
|
||||||
import DeleteAction from '$lib/components/asset-viewer/actions/delete-action.svelte';
|
import DeleteAction from '$lib/components/asset-viewer/actions/delete-action.svelte';
|
||||||
|
import EditAction from '$lib/components/asset-viewer/actions/edit-action.svelte';
|
||||||
import KeepThisDeleteOthersAction from '$lib/components/asset-viewer/actions/keep-this-delete-others.svelte';
|
import KeepThisDeleteOthersAction from '$lib/components/asset-viewer/actions/keep-this-delete-others.svelte';
|
||||||
import RatingAction from '$lib/components/asset-viewer/actions/rating-action.svelte';
|
import RatingAction from '$lib/components/asset-viewer/actions/rating-action.svelte';
|
||||||
import RemoveAssetFromStack from '$lib/components/asset-viewer/actions/remove-asset-from-stack.svelte';
|
import RemoveAssetFromStack from '$lib/components/asset-viewer/actions/remove-asset-from-stack.svelte';
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
import UnstackAction from '$lib/components/asset-viewer/actions/unstack-action.svelte';
|
import UnstackAction from '$lib/components/asset-viewer/actions/unstack-action.svelte';
|
||||||
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
||||||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute, ProjectionType } from '$lib/constants';
|
||||||
import { featureFlagsManager } from '$lib/managers/feature-flags-manager.svelte';
|
import { featureFlagsManager } from '$lib/managers/feature-flags-manager.svelte';
|
||||||
import { getGlobalActions } from '$lib/services/app.service';
|
import { getGlobalActions } from '$lib/services/app.service';
|
||||||
import { getAssetActions, handleReplaceAsset } from '$lib/services/asset.service';
|
import { getAssetActions, handleReplaceAsset } from '$lib/services/asset.service';
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
onUndoDelete?: OnUndoDelete;
|
onUndoDelete?: OnUndoDelete;
|
||||||
onRunJob: (name: AssetJobName) => void;
|
onRunJob: (name: AssetJobName) => void;
|
||||||
onPlaySlideshow: () => void;
|
onPlaySlideshow: () => void;
|
||||||
// onEdit: () => void;
|
onEdit: () => void;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
playOriginalVideo: boolean;
|
playOriginalVideo: boolean;
|
||||||
setPlayOriginalVideo: (value: boolean) => void;
|
setPlayOriginalVideo: (value: boolean) => void;
|
||||||
@@ -92,7 +93,7 @@
|
|||||||
onRunJob,
|
onRunJob,
|
||||||
onPlaySlideshow,
|
onPlaySlideshow,
|
||||||
onClose,
|
onClose,
|
||||||
// onEdit,
|
onEdit,
|
||||||
playOriginalVideo = false,
|
playOriginalVideo = false,
|
||||||
setPlayOriginalVideo,
|
setPlayOriginalVideo,
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
@@ -117,17 +118,17 @@
|
|||||||
const sharedLink = getSharedLink();
|
const sharedLink = getSharedLink();
|
||||||
|
|
||||||
// TODO: Enable when edits are ready for release
|
// TODO: Enable when edits are ready for release
|
||||||
// let showEditorButton = $derived(
|
let showEditorButton = $derived(
|
||||||
// isOwner &&
|
isOwner &&
|
||||||
// asset.type === AssetTypeEnum.Image &&
|
asset.type === AssetTypeEnum.Image &&
|
||||||
// !(
|
!(
|
||||||
// asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR ||
|
asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR ||
|
||||||
// (asset.originalPath && asset.originalPath.toLowerCase().endsWith('.insp'))
|
(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.insp'))
|
||||||
// ) &&
|
) &&
|
||||||
// !(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.gif')) &&
|
!(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.gif')) &&
|
||||||
// !(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.svg')) &&
|
!(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.svg')) &&
|
||||||
// !asset.livePhotoVideoId,
|
!asset.livePhotoVideoId,
|
||||||
// );
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CommandPaletteDefaultProvider
|
<CommandPaletteDefaultProvider
|
||||||
@@ -180,9 +181,9 @@
|
|||||||
<RatingAction {asset} {onAction} />
|
<RatingAction {asset} {onAction} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- {#if showEditorButton}
|
{#if showEditorButton}
|
||||||
<EditAction onAction={onEdit} />
|
<EditAction onAction={onEdit} />
|
||||||
{/if} -->
|
{/if}
|
||||||
|
|
||||||
{#if isOwner}
|
{#if isOwner}
|
||||||
<DeleteAction {asset} {onAction} {preAction} {onUndoDelete} />
|
<DeleteAction {asset} {onAction} {preAction} {onUndoDelete} />
|
||||||
|
|||||||
@@ -255,12 +255,12 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// const showEditor = () => {
|
const showEditor = () => {
|
||||||
// if (assetViewerManager.isShowActivityPanel) {
|
if (assetViewerManager.isShowActivityPanel) {
|
||||||
// assetViewerManager.isShowActivityPanel = false;
|
assetViewerManager.isShowActivityPanel = false;
|
||||||
// }
|
}
|
||||||
// isShowEditor = !isShowEditor;
|
isShowEditor = !isShowEditor;
|
||||||
// };
|
};
|
||||||
|
|
||||||
const handleRunJob = async (name: AssetJobName) => {
|
const handleRunJob = async (name: AssetJobName) => {
|
||||||
try {
|
try {
|
||||||
@@ -432,6 +432,7 @@
|
|||||||
preAction={handlePreAction}
|
preAction={handlePreAction}
|
||||||
onAction={handleAction}
|
onAction={handleAction}
|
||||||
{onUndoDelete}
|
{onUndoDelete}
|
||||||
|
onEdit={showEditor}
|
||||||
onRunJob={handleRunJob}
|
onRunJob={handleRunJob}
|
||||||
onPlaySlideshow={() => ($slideshowState = SlideshowState.PlaySlideshow)}
|
onPlaySlideshow={() => ($slideshowState = SlideshowState.PlaySlideshow)}
|
||||||
onClose={onClose ? () => onClose(asset) : undefined}
|
onClose={onClose ? () => onClose(asset) : undefined}
|
||||||
|
|||||||
Reference in New Issue
Block a user