mirror of
https://github.com/immich-app/immich.git
synced 2025-07-08 02:34:12 -04:00
feat(mobile): add album asset sync (#19522)
* feat(mobile): add album asset sync * add SyncAlbumToAssetDeleteV1 to openapi-spec * update delete queries to use where in statements * clear remote album when clear remote data * fix: bad merge * fix: bad merge * fix: _SyncAckV1 return type --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: wuzihao051119 <wuzihao051119@outlook.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
24a4cba953
commit
ea3a14ed25
2
mobile/drift_schemas/main/drift_schema_v1.json
generated
2
mobile/drift_schemas/main/drift_schema_v1.json
generated
File diff suppressed because one or more lines are too long
79
mobile/lib/domain/models/album/album.model.dart
Normal file
79
mobile/lib/domain/models/album/album.model.dart
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
enum AlbumAssetOrder {
|
||||||
|
// do not change this order!
|
||||||
|
asc,
|
||||||
|
desc,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AlbumUserRole {
|
||||||
|
// do not change this order!
|
||||||
|
editor,
|
||||||
|
viewer,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model for an album stored in the server
|
||||||
|
class Album {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String ownerId;
|
||||||
|
final String description;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final DateTime updatedAt;
|
||||||
|
final String? thumbnailAssetId;
|
||||||
|
final bool isActivityEnabled;
|
||||||
|
final AlbumAssetOrder order;
|
||||||
|
|
||||||
|
const Album({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.ownerId,
|
||||||
|
required this.description,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
this.thumbnailAssetId,
|
||||||
|
required this.isActivityEnabled,
|
||||||
|
required this.order,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '''Album {
|
||||||
|
id: $id,
|
||||||
|
name: $name,
|
||||||
|
ownerId: $ownerId,
|
||||||
|
description: $description,
|
||||||
|
createdAt: $createdAt,
|
||||||
|
updatedAt: $updatedAt,
|
||||||
|
isActivityEnabled: $isActivityEnabled,
|
||||||
|
order: $order,
|
||||||
|
thumbnailAssetId: ${thumbnailAssetId ?? "<NA>"}
|
||||||
|
}''';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (other is! Album) return false;
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return id == other.id &&
|
||||||
|
name == other.name &&
|
||||||
|
ownerId == other.ownerId &&
|
||||||
|
description == other.description &&
|
||||||
|
createdAt == other.createdAt &&
|
||||||
|
updatedAt == other.updatedAt &&
|
||||||
|
thumbnailAssetId == other.thumbnailAssetId &&
|
||||||
|
isActivityEnabled == other.isActivityEnabled &&
|
||||||
|
order == other.order;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return id.hashCode ^
|
||||||
|
name.hashCode ^
|
||||||
|
ownerId.hashCode ^
|
||||||
|
description.hashCode ^
|
||||||
|
createdAt.hashCode ^
|
||||||
|
updatedAt.hashCode ^
|
||||||
|
thumbnailAssetId.hashCode ^
|
||||||
|
isActivityEnabled.hashCode ^
|
||||||
|
order.hashCode;
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,8 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/local_album.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/local_album.model.dart';
|
|
||||||
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
||||||
import 'package:immich_mobile/platform/native_sync_api.g.dart';
|
import 'package:immich_mobile/platform/native_sync_api.g.dart';
|
||||||
import 'package:immich_mobile/presentation/pages/dev/dev_logger.dart';
|
import 'package:immich_mobile/presentation/pages/dev/dev_logger.dart';
|
||||||
|
@ -76,11 +76,76 @@ class SyncStreamService {
|
|||||||
case SyncEntityType.assetExifV1:
|
case SyncEntityType.assetExifV1:
|
||||||
return _syncStreamRepository.updateAssetsExifV1(data.cast());
|
return _syncStreamRepository.updateAssetsExifV1(data.cast());
|
||||||
case SyncEntityType.partnerAssetV1:
|
case SyncEntityType.partnerAssetV1:
|
||||||
return _syncStreamRepository.updatePartnerAssetsV1(data.cast());
|
return _syncStreamRepository.updateAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'partner',
|
||||||
|
);
|
||||||
|
case SyncEntityType.partnerAssetBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'partner backfill',
|
||||||
|
);
|
||||||
case SyncEntityType.partnerAssetDeleteV1:
|
case SyncEntityType.partnerAssetDeleteV1:
|
||||||
return _syncStreamRepository.deletePartnerAssetsV1(data.cast());
|
return _syncStreamRepository.deleteAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: "partner",
|
||||||
|
);
|
||||||
case SyncEntityType.partnerAssetExifV1:
|
case SyncEntityType.partnerAssetExifV1:
|
||||||
return _syncStreamRepository.updatePartnerAssetsExifV1(data.cast());
|
return _syncStreamRepository.updateAssetsExifV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'partner',
|
||||||
|
);
|
||||||
|
case SyncEntityType.partnerAssetExifBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAssetsExifV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'partner backfill',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumV1:
|
||||||
|
return _syncStreamRepository.updateAlbumsV1(data.cast());
|
||||||
|
case SyncEntityType.albumDeleteV1:
|
||||||
|
return _syncStreamRepository.deleteAlbumsV1(data.cast());
|
||||||
|
case SyncEntityType.albumUserV1:
|
||||||
|
return _syncStreamRepository.updateAlbumUsersV1(data.cast());
|
||||||
|
case SyncEntityType.albumUserBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAlbumUsersV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'backfill',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumUserDeleteV1:
|
||||||
|
return _syncStreamRepository.deleteAlbumUsersV1(data.cast());
|
||||||
|
case SyncEntityType.albumAssetV1:
|
||||||
|
return _syncStreamRepository.updateAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'album',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumAssetBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'album backfill',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumAssetExifV1:
|
||||||
|
return _syncStreamRepository.updateAssetsExifV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'album',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumAssetExifBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAssetsExifV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'album backfill',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumToAssetV1:
|
||||||
|
return _syncStreamRepository.updateAlbumToAssetsV1(data.cast());
|
||||||
|
case SyncEntityType.albumToAssetBackfillV1:
|
||||||
|
return _syncStreamRepository.updateAlbumToAssetsV1(
|
||||||
|
data.cast(),
|
||||||
|
debugLabel: 'backfill',
|
||||||
|
);
|
||||||
|
case SyncEntityType.albumToAssetDeleteV1:
|
||||||
|
return _syncStreamRepository.deleteAlbumToAssetsV1(data.cast());
|
||||||
|
// No-op. SyncAckV1 entities are checkpoints in the sync stream
|
||||||
|
// to acknowledge that the client has processed all the backfill events
|
||||||
|
case SyncEntityType.syncAckV1:
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
_logger.warning("Unknown sync data type: $type");
|
_logger.warning("Unknown sync data type: $type");
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,13 @@ class TimelineFactory {
|
|||||||
bucketSource: () =>
|
bucketSource: () =>
|
||||||
_timelineRepository.watchLocalBucket(albumId, groupBy: groupBy),
|
_timelineRepository.watchLocalBucket(albumId, groupBy: groupBy),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TimelineService remoteAlbum({required String albumId}) => TimelineService(
|
||||||
|
assetSource: (offset, count) => _timelineRepository
|
||||||
|
.getRemoteBucketAssets(albumId, offset: offset, count: count),
|
||||||
|
bucketSource: () =>
|
||||||
|
_timelineRepository.watchRemoteBucket(albumId, groupBy: groupBy),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimelineService {
|
class TimelineService {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:immich_mobile/domain/models/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
class LocalAlbumEntity extends Table with DriftDefaultsMixin {
|
class LocalAlbumEntity extends Table with DriftDefaultsMixin {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import 'package:drift/drift.dart' as i0;
|
import 'package:drift/drift.dart' as i0;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart'
|
||||||
as i1;
|
as i1;
|
||||||
import 'package:immich_mobile/domain/models/local_album.model.dart' as i2;
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart' as i2;
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart'
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart'
|
||||||
as i3;
|
as i3;
|
||||||
import 'package:drift/src/runtime/query_builder/query_builder.dart' as i4;
|
import 'package:drift/src/runtime/query_builder/query_builder.dart' as i4;
|
||||||
|
34
mobile/lib/infrastructure/entities/remote_album.entity.dart
Normal file
34
mobile/lib/infrastructure/entities/remote_album.entity.dart
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
|
class RemoteAlbumEntity extends Table with DriftDefaultsMixin {
|
||||||
|
const RemoteAlbumEntity();
|
||||||
|
|
||||||
|
TextColumn get id => text()();
|
||||||
|
|
||||||
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
TextColumn get description => text().withDefault(const Constant(''))();
|
||||||
|
|
||||||
|
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
|
DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
|
||||||
|
|
||||||
|
TextColumn get ownerId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
TextColumn get thumbnailAssetId => text()
|
||||||
|
.references(RemoteAssetEntity, #id, onDelete: KeyAction.setNull)
|
||||||
|
.nullable()();
|
||||||
|
|
||||||
|
BoolColumn get isActivityEnabled =>
|
||||||
|
boolean().withDefault(const Constant(true))();
|
||||||
|
|
||||||
|
IntColumn get order => intEnum<AlbumAssetOrder>()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column> get primaryKey => {id};
|
||||||
|
}
|
946
mobile/lib/infrastructure/entities/remote_album.entity.drift.dart
generated
Normal file
946
mobile/lib/infrastructure/entities/remote_album.entity.drift.dart
generated
Normal file
@ -0,0 +1,946 @@
|
|||||||
|
// dart format width=80
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:drift/drift.dart' as i0;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
|
as i1;
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.model.dart' as i2;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.dart'
|
||||||
|
as i3;
|
||||||
|
import 'package:drift/src/runtime/query_builder/query_builder.dart' as i4;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
||||||
|
as i5;
|
||||||
|
import 'package:drift/internal/modular.dart' as i6;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart'
|
||||||
|
as i7;
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumEntityTableCreateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumEntityCompanion Function({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
i0.Value<String> description,
|
||||||
|
i0.Value<DateTime> createdAt,
|
||||||
|
i0.Value<DateTime> updatedAt,
|
||||||
|
required String ownerId,
|
||||||
|
i0.Value<String?> thumbnailAssetId,
|
||||||
|
i0.Value<bool> isActivityEnabled,
|
||||||
|
required i2.AlbumAssetOrder order,
|
||||||
|
});
|
||||||
|
typedef $$RemoteAlbumEntityTableUpdateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumEntityCompanion Function({
|
||||||
|
i0.Value<String> id,
|
||||||
|
i0.Value<String> name,
|
||||||
|
i0.Value<String> description,
|
||||||
|
i0.Value<DateTime> createdAt,
|
||||||
|
i0.Value<DateTime> updatedAt,
|
||||||
|
i0.Value<String> ownerId,
|
||||||
|
i0.Value<String?> thumbnailAssetId,
|
||||||
|
i0.Value<bool> isActivityEnabled,
|
||||||
|
i0.Value<i2.AlbumAssetOrder> order,
|
||||||
|
});
|
||||||
|
|
||||||
|
final class $$RemoteAlbumEntityTableReferences extends i0.BaseReferences<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumEntityTable,
|
||||||
|
i1.RemoteAlbumEntityData> {
|
||||||
|
$$RemoteAlbumEntityTableReferences(
|
||||||
|
super.$_db, super.$_table, super.$_typedResult);
|
||||||
|
|
||||||
|
static i5.$UserEntityTable _ownerIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.ownerId,
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i5.$$UserEntityTableProcessedTableManager get ownerId {
|
||||||
|
final $_column = $_itemColumn<String>('owner_id')!;
|
||||||
|
|
||||||
|
final manager = i5
|
||||||
|
.$$UserEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i6.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'))
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_ownerIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]));
|
||||||
|
}
|
||||||
|
|
||||||
|
static i7.$RemoteAssetEntityTable _thumbnailAssetIdTable(
|
||||||
|
i0.GeneratedDatabase db) =>
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.thumbnailAssetId,
|
||||||
|
i6.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i7.$$RemoteAssetEntityTableProcessedTableManager? get thumbnailAssetId {
|
||||||
|
final $_column = $_itemColumn<String>('thumbnail_asset_id');
|
||||||
|
if ($_column == null) return null;
|
||||||
|
final manager = i7
|
||||||
|
.$$RemoteAssetEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i6.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity'))
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_thumbnailAssetIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumEntityTableFilterComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumEntityTable> {
|
||||||
|
$$RemoteAlbumEntityTableFilterComposer({
|
||||||
|
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.ColumnFilters<String> get name => $composableBuilder(
|
||||||
|
column: $table.name, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<String> get description => $composableBuilder(
|
||||||
|
column: $table.description,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
||||||
|
column: $table.createdAt, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
||||||
|
column: $table.updatedAt, builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnFilters<bool> get isActivityEnabled => $composableBuilder(
|
||||||
|
column: $table.isActivityEnabled,
|
||||||
|
builder: (column) => i0.ColumnFilters(column));
|
||||||
|
|
||||||
|
i0.ColumnWithTypeConverterFilters<i2.AlbumAssetOrder, i2.AlbumAssetOrder, int>
|
||||||
|
get order => $composableBuilder(
|
||||||
|
column: $table.order,
|
||||||
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||||
|
|
||||||
|
i5.$$UserEntityTableFilterComposer get ownerId {
|
||||||
|
final i5.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.ownerId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$UserEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i7.$$RemoteAssetEntityTableFilterComposer get thumbnailAssetId {
|
||||||
|
final i7.$$RemoteAssetEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.thumbnailAssetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i7.$$RemoteAssetEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumEntityTableOrderingComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumEntityTable> {
|
||||||
|
$$RemoteAlbumEntityTableOrderingComposer({
|
||||||
|
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<String> get name => $composableBuilder(
|
||||||
|
column: $table.name, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<String> get description => $composableBuilder(
|
||||||
|
column: $table.description,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
||||||
|
column: $table.createdAt,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
||||||
|
column: $table.updatedAt,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<bool> get isActivityEnabled => $composableBuilder(
|
||||||
|
column: $table.isActivityEnabled,
|
||||||
|
builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i0.ColumnOrderings<int> get order => $composableBuilder(
|
||||||
|
column: $table.order, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i5.$$UserEntityTableOrderingComposer get ownerId {
|
||||||
|
final i5.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.ownerId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$UserEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i7.$$RemoteAssetEntityTableOrderingComposer get thumbnailAssetId {
|
||||||
|
final i7.$$RemoteAssetEntityTableOrderingComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.thumbnailAssetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i7.$$RemoteAssetEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>(
|
||||||
|
'remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumEntityTableAnnotationComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumEntityTable> {
|
||||||
|
$$RemoteAlbumEntityTableAnnotationComposer({
|
||||||
|
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.GeneratedColumn<String> get name =>
|
||||||
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<String> get description => $composableBuilder(
|
||||||
|
column: $table.description, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<DateTime> get createdAt =>
|
||||||
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<DateTime> get updatedAt =>
|
||||||
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumn<bool> get isActivityEnabled => $composableBuilder(
|
||||||
|
column: $table.isActivityEnabled, builder: (column) => column);
|
||||||
|
|
||||||
|
i0.GeneratedColumnWithTypeConverter<i2.AlbumAssetOrder, int> get order =>
|
||||||
|
$composableBuilder(column: $table.order, builder: (column) => column);
|
||||||
|
|
||||||
|
i5.$$UserEntityTableAnnotationComposer get ownerId {
|
||||||
|
final i5.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.ownerId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$UserEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i7.$$RemoteAssetEntityTableAnnotationComposer get thumbnailAssetId {
|
||||||
|
final i7.$$RemoteAssetEntityTableAnnotationComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.thumbnailAssetId,
|
||||||
|
referencedTable: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i7.$$RemoteAssetEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i6.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i7.$RemoteAssetEntityTable>(
|
||||||
|
'remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumEntityTableTableManager extends i0.RootTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumEntityTable,
|
||||||
|
i1.RemoteAlbumEntityData,
|
||||||
|
i1.$$RemoteAlbumEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.RemoteAlbumEntityData, i1.$$RemoteAlbumEntityTableReferences),
|
||||||
|
i1.RemoteAlbumEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool ownerId, bool thumbnailAssetId})> {
|
||||||
|
$$RemoteAlbumEntityTableTableManager(
|
||||||
|
i0.GeneratedDatabase db, i1.$RemoteAlbumEntityTable table)
|
||||||
|
: super(i0.TableManagerState(
|
||||||
|
db: db,
|
||||||
|
table: table,
|
||||||
|
createFilteringComposer: () =>
|
||||||
|
i1.$$RemoteAlbumEntityTableFilterComposer($db: db, $table: table),
|
||||||
|
createOrderingComposer: () => i1
|
||||||
|
.$$RemoteAlbumEntityTableOrderingComposer($db: db, $table: table),
|
||||||
|
createComputedFieldComposer: () =>
|
||||||
|
i1.$$RemoteAlbumEntityTableAnnotationComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
updateCompanionCallback: ({
|
||||||
|
i0.Value<String> id = const i0.Value.absent(),
|
||||||
|
i0.Value<String> name = const i0.Value.absent(),
|
||||||
|
i0.Value<String> description = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> createdAt = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> updatedAt = const i0.Value.absent(),
|
||||||
|
i0.Value<String> ownerId = const i0.Value.absent(),
|
||||||
|
i0.Value<String?> thumbnailAssetId = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> isActivityEnabled = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AlbumAssetOrder> order = const i0.Value.absent(),
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumEntityCompanion(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
description: description,
|
||||||
|
createdAt: createdAt,
|
||||||
|
updatedAt: updatedAt,
|
||||||
|
ownerId: ownerId,
|
||||||
|
thumbnailAssetId: thumbnailAssetId,
|
||||||
|
isActivityEnabled: isActivityEnabled,
|
||||||
|
order: order,
|
||||||
|
),
|
||||||
|
createCompanionCallback: ({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
i0.Value<String> description = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> createdAt = const i0.Value.absent(),
|
||||||
|
i0.Value<DateTime> updatedAt = const i0.Value.absent(),
|
||||||
|
required String ownerId,
|
||||||
|
i0.Value<String?> thumbnailAssetId = const i0.Value.absent(),
|
||||||
|
i0.Value<bool> isActivityEnabled = const i0.Value.absent(),
|
||||||
|
required i2.AlbumAssetOrder order,
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumEntityCompanion.insert(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
description: description,
|
||||||
|
createdAt: createdAt,
|
||||||
|
updatedAt: updatedAt,
|
||||||
|
ownerId: ownerId,
|
||||||
|
thumbnailAssetId: thumbnailAssetId,
|
||||||
|
isActivityEnabled: isActivityEnabled,
|
||||||
|
order: order,
|
||||||
|
),
|
||||||
|
withReferenceMapper: (p0) => p0
|
||||||
|
.map((e) => (
|
||||||
|
e.readTable(table),
|
||||||
|
i1.$$RemoteAlbumEntityTableReferences(db, table, e)
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
prefetchHooksCallback: ({ownerId = false, thumbnailAssetId = 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 (ownerId) {
|
||||||
|
state = state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.ownerId,
|
||||||
|
referencedTable:
|
||||||
|
i1.$$RemoteAlbumEntityTableReferences._ownerIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumEntityTableReferences
|
||||||
|
._ownerIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
if (thumbnailAssetId) {
|
||||||
|
state = state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.thumbnailAssetId,
|
||||||
|
referencedTable: i1.$$RemoteAlbumEntityTableReferences
|
||||||
|
._thumbnailAssetIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumEntityTableReferences
|
||||||
|
._thumbnailAssetIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
getPrefetchedDataCallback: (items) async {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumEntityTableProcessedTableManager
|
||||||
|
= i0.ProcessedTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumEntityTable,
|
||||||
|
i1.RemoteAlbumEntityData,
|
||||||
|
i1.$$RemoteAlbumEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.RemoteAlbumEntityData, i1.$$RemoteAlbumEntityTableReferences),
|
||||||
|
i1.RemoteAlbumEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool ownerId, bool thumbnailAssetId})>;
|
||||||
|
|
||||||
|
class $RemoteAlbumEntityTable extends i3.RemoteAlbumEntity
|
||||||
|
with i0.TableInfo<$RemoteAlbumEntityTable, i1.RemoteAlbumEntityData> {
|
||||||
|
@override
|
||||||
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
$RemoteAlbumEntityTable(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 _nameMeta =
|
||||||
|
const i0.VerificationMeta('name');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> name = i0.GeneratedColumn<String>(
|
||||||
|
'name', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string, requiredDuringInsert: true);
|
||||||
|
static const i0.VerificationMeta _descriptionMeta =
|
||||||
|
const i0.VerificationMeta('description');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> description =
|
||||||
|
i0.GeneratedColumn<String>('description', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: const i4.Constant(''));
|
||||||
|
static const i0.VerificationMeta _createdAtMeta =
|
||||||
|
const i0.VerificationMeta('createdAt');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<DateTime> createdAt =
|
||||||
|
i0.GeneratedColumn<DateTime>('created_at', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.dateTime,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: i4.currentDateAndTime);
|
||||||
|
static const i0.VerificationMeta _updatedAtMeta =
|
||||||
|
const i0.VerificationMeta('updatedAt');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<DateTime> updatedAt =
|
||||||
|
i0.GeneratedColumn<DateTime>('updated_at', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.dateTime,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultValue: i4.currentDateAndTime);
|
||||||
|
static const i0.VerificationMeta _ownerIdMeta =
|
||||||
|
const i0.VerificationMeta('ownerId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> ownerId = i0.GeneratedColumn<String>(
|
||||||
|
'owner_id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES user_entity (id) ON DELETE CASCADE'));
|
||||||
|
static const i0.VerificationMeta _thumbnailAssetIdMeta =
|
||||||
|
const i0.VerificationMeta('thumbnailAssetId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> thumbnailAssetId =
|
||||||
|
i0.GeneratedColumn<String>('thumbnail_asset_id', aliasedName, true,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES remote_asset_entity (id) ON DELETE SET NULL'));
|
||||||
|
static const i0.VerificationMeta _isActivityEnabledMeta =
|
||||||
|
const i0.VerificationMeta('isActivityEnabled');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<bool> isActivityEnabled =
|
||||||
|
i0.GeneratedColumn<bool>('is_activity_enabled', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.bool,
|
||||||
|
requiredDuringInsert: false,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'CHECK ("is_activity_enabled" IN (0, 1))'),
|
||||||
|
defaultValue: const i4.Constant(true));
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumnWithTypeConverter<i2.AlbumAssetOrder, int>
|
||||||
|
order = i0.GeneratedColumn<int>('order', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.int, requiredDuringInsert: true)
|
||||||
|
.withConverter<i2.AlbumAssetOrder>(
|
||||||
|
i1.$RemoteAlbumEntityTable.$converterorder);
|
||||||
|
@override
|
||||||
|
List<i0.GeneratedColumn> get $columns => [
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
createdAt,
|
||||||
|
updatedAt,
|
||||||
|
ownerId,
|
||||||
|
thumbnailAssetId,
|
||||||
|
isActivityEnabled,
|
||||||
|
order
|
||||||
|
];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
|
@override
|
||||||
|
String get actualTableName => $name;
|
||||||
|
static const String $name = 'remote_album_entity';
|
||||||
|
@override
|
||||||
|
i0.VerificationContext validateIntegrity(
|
||||||
|
i0.Insertable<i1.RemoteAlbumEntityData> 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('name')) {
|
||||||
|
context.handle(
|
||||||
|
_nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_nameMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('description')) {
|
||||||
|
context.handle(
|
||||||
|
_descriptionMeta,
|
||||||
|
description.isAcceptableOrUnknown(
|
||||||
|
data['description']!, _descriptionMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('created_at')) {
|
||||||
|
context.handle(_createdAtMeta,
|
||||||
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('updated_at')) {
|
||||||
|
context.handle(_updatedAtMeta,
|
||||||
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('owner_id')) {
|
||||||
|
context.handle(_ownerIdMeta,
|
||||||
|
ownerId.isAcceptableOrUnknown(data['owner_id']!, _ownerIdMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_ownerIdMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('thumbnail_asset_id')) {
|
||||||
|
context.handle(
|
||||||
|
_thumbnailAssetIdMeta,
|
||||||
|
thumbnailAssetId.isAcceptableOrUnknown(
|
||||||
|
data['thumbnail_asset_id']!, _thumbnailAssetIdMeta));
|
||||||
|
}
|
||||||
|
if (data.containsKey('is_activity_enabled')) {
|
||||||
|
context.handle(
|
||||||
|
_isActivityEnabledMeta,
|
||||||
|
isActivityEnabled.isAcceptableOrUnknown(
|
||||||
|
data['is_activity_enabled']!, _isActivityEnabledMeta));
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<i0.GeneratedColumn> get $primaryKey => {id};
|
||||||
|
@override
|
||||||
|
i1.RemoteAlbumEntityData map(Map<String, dynamic> data,
|
||||||
|
{String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return i1.RemoteAlbumEntityData(
|
||||||
|
id: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}id'])!,
|
||||||
|
name: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}name'])!,
|
||||||
|
description: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}description'])!,
|
||||||
|
createdAt: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
|
||||||
|
updatedAt: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!,
|
||||||
|
ownerId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}owner_id'])!,
|
||||||
|
thumbnailAssetId: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.string, data['${effectivePrefix}thumbnail_asset_id']),
|
||||||
|
isActivityEnabled: attachedDatabase.typeMapping.read(
|
||||||
|
i0.DriftSqlType.bool, data['${effectivePrefix}is_activity_enabled'])!,
|
||||||
|
order: i1.$RemoteAlbumEntityTable.$converterorder.fromSql(attachedDatabase
|
||||||
|
.typeMapping
|
||||||
|
.read(i0.DriftSqlType.int, data['${effectivePrefix}order'])!),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
$RemoteAlbumEntityTable createAlias(String alias) {
|
||||||
|
return $RemoteAlbumEntityTable(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
static i0.JsonTypeConverter2<i2.AlbumAssetOrder, int, int> $converterorder =
|
||||||
|
const i0.EnumIndexConverter<i2.AlbumAssetOrder>(
|
||||||
|
i2.AlbumAssetOrder.values);
|
||||||
|
@override
|
||||||
|
bool get withoutRowId => true;
|
||||||
|
@override
|
||||||
|
bool get isStrict => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumEntityData extends i0.DataClass
|
||||||
|
implements i0.Insertable<i1.RemoteAlbumEntityData> {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String description;
|
||||||
|
final DateTime createdAt;
|
||||||
|
final DateTime updatedAt;
|
||||||
|
final String ownerId;
|
||||||
|
final String? thumbnailAssetId;
|
||||||
|
final bool isActivityEnabled;
|
||||||
|
final i2.AlbumAssetOrder order;
|
||||||
|
const RemoteAlbumEntityData(
|
||||||
|
{required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.description,
|
||||||
|
required this.createdAt,
|
||||||
|
required this.updatedAt,
|
||||||
|
required this.ownerId,
|
||||||
|
this.thumbnailAssetId,
|
||||||
|
required this.isActivityEnabled,
|
||||||
|
required this.order});
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
map['id'] = i0.Variable<String>(id);
|
||||||
|
map['name'] = i0.Variable<String>(name);
|
||||||
|
map['description'] = i0.Variable<String>(description);
|
||||||
|
map['created_at'] = i0.Variable<DateTime>(createdAt);
|
||||||
|
map['updated_at'] = i0.Variable<DateTime>(updatedAt);
|
||||||
|
map['owner_id'] = i0.Variable<String>(ownerId);
|
||||||
|
if (!nullToAbsent || thumbnailAssetId != null) {
|
||||||
|
map['thumbnail_asset_id'] = i0.Variable<String>(thumbnailAssetId);
|
||||||
|
}
|
||||||
|
map['is_activity_enabled'] = i0.Variable<bool>(isActivityEnabled);
|
||||||
|
{
|
||||||
|
map['order'] = i0.Variable<int>(
|
||||||
|
i1.$RemoteAlbumEntityTable.$converterorder.toSql(order));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory RemoteAlbumEntityData.fromJson(Map<String, dynamic> json,
|
||||||
|
{i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return RemoteAlbumEntityData(
|
||||||
|
id: serializer.fromJson<String>(json['id']),
|
||||||
|
name: serializer.fromJson<String>(json['name']),
|
||||||
|
description: serializer.fromJson<String>(json['description']),
|
||||||
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||||
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
||||||
|
ownerId: serializer.fromJson<String>(json['ownerId']),
|
||||||
|
thumbnailAssetId: serializer.fromJson<String?>(json['thumbnailAssetId']),
|
||||||
|
isActivityEnabled: serializer.fromJson<bool>(json['isActivityEnabled']),
|
||||||
|
order: i1.$RemoteAlbumEntityTable.$converterorder
|
||||||
|
.fromJson(serializer.fromJson<int>(json['order'])),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'id': serializer.toJson<String>(id),
|
||||||
|
'name': serializer.toJson<String>(name),
|
||||||
|
'description': serializer.toJson<String>(description),
|
||||||
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||||
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
||||||
|
'ownerId': serializer.toJson<String>(ownerId),
|
||||||
|
'thumbnailAssetId': serializer.toJson<String?>(thumbnailAssetId),
|
||||||
|
'isActivityEnabled': serializer.toJson<bool>(isActivityEnabled),
|
||||||
|
'order': serializer.toJson<int>(
|
||||||
|
i1.$RemoteAlbumEntityTable.$converterorder.toJson(order)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumEntityData copyWith(
|
||||||
|
{String? id,
|
||||||
|
String? name,
|
||||||
|
String? description,
|
||||||
|
DateTime? createdAt,
|
||||||
|
DateTime? updatedAt,
|
||||||
|
String? ownerId,
|
||||||
|
i0.Value<String?> thumbnailAssetId = const i0.Value.absent(),
|
||||||
|
bool? isActivityEnabled,
|
||||||
|
i2.AlbumAssetOrder? order}) =>
|
||||||
|
i1.RemoteAlbumEntityData(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
description: description ?? this.description,
|
||||||
|
createdAt: createdAt ?? this.createdAt,
|
||||||
|
updatedAt: updatedAt ?? this.updatedAt,
|
||||||
|
ownerId: ownerId ?? this.ownerId,
|
||||||
|
thumbnailAssetId: thumbnailAssetId.present
|
||||||
|
? thumbnailAssetId.value
|
||||||
|
: this.thumbnailAssetId,
|
||||||
|
isActivityEnabled: isActivityEnabled ?? this.isActivityEnabled,
|
||||||
|
order: order ?? this.order,
|
||||||
|
);
|
||||||
|
RemoteAlbumEntityData copyWithCompanion(i1.RemoteAlbumEntityCompanion data) {
|
||||||
|
return RemoteAlbumEntityData(
|
||||||
|
id: data.id.present ? data.id.value : this.id,
|
||||||
|
name: data.name.present ? data.name.value : this.name,
|
||||||
|
description:
|
||||||
|
data.description.present ? data.description.value : this.description,
|
||||||
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||||
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
||||||
|
ownerId: data.ownerId.present ? data.ownerId.value : this.ownerId,
|
||||||
|
thumbnailAssetId: data.thumbnailAssetId.present
|
||||||
|
? data.thumbnailAssetId.value
|
||||||
|
: this.thumbnailAssetId,
|
||||||
|
isActivityEnabled: data.isActivityEnabled.present
|
||||||
|
? data.isActivityEnabled.value
|
||||||
|
: this.isActivityEnabled,
|
||||||
|
order: data.order.present ? data.order.value : this.order,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumEntityData(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('description: $description, ')
|
||||||
|
..write('createdAt: $createdAt, ')
|
||||||
|
..write('updatedAt: $updatedAt, ')
|
||||||
|
..write('ownerId: $ownerId, ')
|
||||||
|
..write('thumbnailAssetId: $thumbnailAssetId, ')
|
||||||
|
..write('isActivityEnabled: $isActivityEnabled, ')
|
||||||
|
..write('order: $order')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(id, name, description, createdAt, updatedAt,
|
||||||
|
ownerId, thumbnailAssetId, isActivityEnabled, order);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is i1.RemoteAlbumEntityData &&
|
||||||
|
other.id == this.id &&
|
||||||
|
other.name == this.name &&
|
||||||
|
other.description == this.description &&
|
||||||
|
other.createdAt == this.createdAt &&
|
||||||
|
other.updatedAt == this.updatedAt &&
|
||||||
|
other.ownerId == this.ownerId &&
|
||||||
|
other.thumbnailAssetId == this.thumbnailAssetId &&
|
||||||
|
other.isActivityEnabled == this.isActivityEnabled &&
|
||||||
|
other.order == this.order);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumEntityCompanion
|
||||||
|
extends i0.UpdateCompanion<i1.RemoteAlbumEntityData> {
|
||||||
|
final i0.Value<String> id;
|
||||||
|
final i0.Value<String> name;
|
||||||
|
final i0.Value<String> description;
|
||||||
|
final i0.Value<DateTime> createdAt;
|
||||||
|
final i0.Value<DateTime> updatedAt;
|
||||||
|
final i0.Value<String> ownerId;
|
||||||
|
final i0.Value<String?> thumbnailAssetId;
|
||||||
|
final i0.Value<bool> isActivityEnabled;
|
||||||
|
final i0.Value<i2.AlbumAssetOrder> order;
|
||||||
|
const RemoteAlbumEntityCompanion({
|
||||||
|
this.id = const i0.Value.absent(),
|
||||||
|
this.name = const i0.Value.absent(),
|
||||||
|
this.description = const i0.Value.absent(),
|
||||||
|
this.createdAt = const i0.Value.absent(),
|
||||||
|
this.updatedAt = const i0.Value.absent(),
|
||||||
|
this.ownerId = const i0.Value.absent(),
|
||||||
|
this.thumbnailAssetId = const i0.Value.absent(),
|
||||||
|
this.isActivityEnabled = const i0.Value.absent(),
|
||||||
|
this.order = const i0.Value.absent(),
|
||||||
|
});
|
||||||
|
RemoteAlbumEntityCompanion.insert({
|
||||||
|
required String id,
|
||||||
|
required String name,
|
||||||
|
this.description = const i0.Value.absent(),
|
||||||
|
this.createdAt = const i0.Value.absent(),
|
||||||
|
this.updatedAt = const i0.Value.absent(),
|
||||||
|
required String ownerId,
|
||||||
|
this.thumbnailAssetId = const i0.Value.absent(),
|
||||||
|
this.isActivityEnabled = const i0.Value.absent(),
|
||||||
|
required i2.AlbumAssetOrder order,
|
||||||
|
}) : id = i0.Value(id),
|
||||||
|
name = i0.Value(name),
|
||||||
|
ownerId = i0.Value(ownerId),
|
||||||
|
order = i0.Value(order);
|
||||||
|
static i0.Insertable<i1.RemoteAlbumEntityData> custom({
|
||||||
|
i0.Expression<String>? id,
|
||||||
|
i0.Expression<String>? name,
|
||||||
|
i0.Expression<String>? description,
|
||||||
|
i0.Expression<DateTime>? createdAt,
|
||||||
|
i0.Expression<DateTime>? updatedAt,
|
||||||
|
i0.Expression<String>? ownerId,
|
||||||
|
i0.Expression<String>? thumbnailAssetId,
|
||||||
|
i0.Expression<bool>? isActivityEnabled,
|
||||||
|
i0.Expression<int>? order,
|
||||||
|
}) {
|
||||||
|
return i0.RawValuesInsertable({
|
||||||
|
if (id != null) 'id': id,
|
||||||
|
if (name != null) 'name': name,
|
||||||
|
if (description != null) 'description': description,
|
||||||
|
if (createdAt != null) 'created_at': createdAt,
|
||||||
|
if (updatedAt != null) 'updated_at': updatedAt,
|
||||||
|
if (ownerId != null) 'owner_id': ownerId,
|
||||||
|
if (thumbnailAssetId != null) 'thumbnail_asset_id': thumbnailAssetId,
|
||||||
|
if (isActivityEnabled != null) 'is_activity_enabled': isActivityEnabled,
|
||||||
|
if (order != null) 'order': order,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumEntityCompanion copyWith(
|
||||||
|
{i0.Value<String>? id,
|
||||||
|
i0.Value<String>? name,
|
||||||
|
i0.Value<String>? description,
|
||||||
|
i0.Value<DateTime>? createdAt,
|
||||||
|
i0.Value<DateTime>? updatedAt,
|
||||||
|
i0.Value<String>? ownerId,
|
||||||
|
i0.Value<String?>? thumbnailAssetId,
|
||||||
|
i0.Value<bool>? isActivityEnabled,
|
||||||
|
i0.Value<i2.AlbumAssetOrder>? order}) {
|
||||||
|
return i1.RemoteAlbumEntityCompanion(
|
||||||
|
id: id ?? this.id,
|
||||||
|
name: name ?? this.name,
|
||||||
|
description: description ?? this.description,
|
||||||
|
createdAt: createdAt ?? this.createdAt,
|
||||||
|
updatedAt: updatedAt ?? this.updatedAt,
|
||||||
|
ownerId: ownerId ?? this.ownerId,
|
||||||
|
thumbnailAssetId: thumbnailAssetId ?? this.thumbnailAssetId,
|
||||||
|
isActivityEnabled: isActivityEnabled ?? this.isActivityEnabled,
|
||||||
|
order: order ?? this.order,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
if (id.present) {
|
||||||
|
map['id'] = i0.Variable<String>(id.value);
|
||||||
|
}
|
||||||
|
if (name.present) {
|
||||||
|
map['name'] = i0.Variable<String>(name.value);
|
||||||
|
}
|
||||||
|
if (description.present) {
|
||||||
|
map['description'] = i0.Variable<String>(description.value);
|
||||||
|
}
|
||||||
|
if (createdAt.present) {
|
||||||
|
map['created_at'] = i0.Variable<DateTime>(createdAt.value);
|
||||||
|
}
|
||||||
|
if (updatedAt.present) {
|
||||||
|
map['updated_at'] = i0.Variable<DateTime>(updatedAt.value);
|
||||||
|
}
|
||||||
|
if (ownerId.present) {
|
||||||
|
map['owner_id'] = i0.Variable<String>(ownerId.value);
|
||||||
|
}
|
||||||
|
if (thumbnailAssetId.present) {
|
||||||
|
map['thumbnail_asset_id'] = i0.Variable<String>(thumbnailAssetId.value);
|
||||||
|
}
|
||||||
|
if (isActivityEnabled.present) {
|
||||||
|
map['is_activity_enabled'] = i0.Variable<bool>(isActivityEnabled.value);
|
||||||
|
}
|
||||||
|
if (order.present) {
|
||||||
|
map['order'] = i0.Variable<int>(
|
||||||
|
i1.$RemoteAlbumEntityTable.$converterorder.toSql(order.value));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumEntityCompanion(')
|
||||||
|
..write('id: $id, ')
|
||||||
|
..write('name: $name, ')
|
||||||
|
..write('description: $description, ')
|
||||||
|
..write('createdAt: $createdAt, ')
|
||||||
|
..write('updatedAt: $updatedAt, ')
|
||||||
|
..write('ownerId: $ownerId, ')
|
||||||
|
..write('thumbnailAssetId: $thumbnailAssetId, ')
|
||||||
|
..write('isActivityEnabled: $isActivityEnabled, ')
|
||||||
|
..write('order: $order')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
|
class RemoteAlbumAssetEntity extends Table with DriftDefaultsMixin {
|
||||||
|
const RemoteAlbumAssetEntity();
|
||||||
|
|
||||||
|
TextColumn get assetId =>
|
||||||
|
text().references(RemoteAssetEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
TextColumn get albumId =>
|
||||||
|
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column> get primaryKey => {assetId, albumId};
|
||||||
|
}
|
565
mobile/lib/infrastructure/entities/remote_album_asset.entity.drift.dart
generated
Normal file
565
mobile/lib/infrastructure/entities/remote_album_asset.entity.drift.dart
generated
Normal file
@ -0,0 +1,565 @@
|
|||||||
|
// dart format width=80
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:drift/drift.dart' as i0;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
||||||
|
as i1;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.dart'
|
||||||
|
as i2;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart'
|
||||||
|
as i3;
|
||||||
|
import 'package:drift/internal/modular.dart' as i4;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
|
as i5;
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumAssetEntityTableCreateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumAssetEntityCompanion Function({
|
||||||
|
required String assetId,
|
||||||
|
required String albumId,
|
||||||
|
});
|
||||||
|
typedef $$RemoteAlbumAssetEntityTableUpdateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumAssetEntityCompanion Function({
|
||||||
|
i0.Value<String> assetId,
|
||||||
|
i0.Value<String> albumId,
|
||||||
|
});
|
||||||
|
|
||||||
|
final class $$RemoteAlbumAssetEntityTableReferences extends i0.BaseReferences<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumAssetEntityTable,
|
||||||
|
i1.RemoteAlbumAssetEntityData> {
|
||||||
|
$$RemoteAlbumAssetEntityTableReferences(
|
||||||
|
super.$_db, super.$_table, super.$_typedResult);
|
||||||
|
|
||||||
|
static i3.$RemoteAssetEntityTable _assetIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumAssetEntityTable>(
|
||||||
|
'remote_album_asset_entity')
|
||||||
|
.assetId,
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i3.$$RemoteAssetEntityTableProcessedTableManager get assetId {
|
||||||
|
final $_column = $_itemColumn<String>('asset_id')!;
|
||||||
|
|
||||||
|
final manager = i3
|
||||||
|
.$$RemoteAssetEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i4.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i3.$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]));
|
||||||
|
}
|
||||||
|
|
||||||
|
static i5.$RemoteAlbumEntityTable _albumIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumAssetEntityTable>(
|
||||||
|
'remote_album_asset_entity')
|
||||||
|
.albumId,
|
||||||
|
i4.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i5.$$RemoteAlbumEntityTableProcessedTableManager get albumId {
|
||||||
|
final $_column = $_itemColumn<String>('album_id')!;
|
||||||
|
|
||||||
|
final manager = i5
|
||||||
|
.$$RemoteAlbumEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i4.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity'))
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_albumIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumAssetEntityTableFilterComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumAssetEntityTable> {
|
||||||
|
$$RemoteAlbumAssetEntityTableFilterComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i3.$$RemoteAssetEntityTableFilterComposer get assetId {
|
||||||
|
final i3.$$RemoteAssetEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i3.$$RemoteAssetEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i5.$$RemoteAlbumEntityTableFilterComposer get albumId {
|
||||||
|
final i5.$$RemoteAlbumEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$RemoteAlbumEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumAssetEntityTableOrderingComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumAssetEntityTable> {
|
||||||
|
$$RemoteAlbumAssetEntityTableOrderingComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i3.$$RemoteAssetEntityTableOrderingComposer get assetId {
|
||||||
|
final i3.$$RemoteAssetEntityTableOrderingComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i3.$$RemoteAssetEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>(
|
||||||
|
'remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i5.$$RemoteAlbumEntityTableOrderingComposer get albumId {
|
||||||
|
final i5.$$RemoteAlbumEntityTableOrderingComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$RemoteAlbumEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>(
|
||||||
|
'remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumAssetEntityTableAnnotationComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumAssetEntityTable> {
|
||||||
|
$$RemoteAlbumAssetEntityTableAnnotationComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i3.$$RemoteAssetEntityTableAnnotationComposer get assetId {
|
||||||
|
final i3.$$RemoteAssetEntityTableAnnotationComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.assetId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>('remote_asset_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i3.$$RemoteAssetEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i3.$RemoteAssetEntityTable>(
|
||||||
|
'remote_asset_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i5.$$RemoteAlbumEntityTableAnnotationComposer get albumId {
|
||||||
|
final i5.$$RemoteAlbumEntityTableAnnotationComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i5.$$RemoteAlbumEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i4.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i5.$RemoteAlbumEntityTable>(
|
||||||
|
'remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumAssetEntityTableTableManager extends i0.RootTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumAssetEntityTable,
|
||||||
|
i1.RemoteAlbumAssetEntityData,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumAssetEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumAssetEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.RemoteAlbumAssetEntityData, i1.$$RemoteAlbumAssetEntityTableReferences),
|
||||||
|
i1.RemoteAlbumAssetEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool assetId, bool albumId})> {
|
||||||
|
$$RemoteAlbumAssetEntityTableTableManager(
|
||||||
|
i0.GeneratedDatabase db, i1.$RemoteAlbumAssetEntityTable table)
|
||||||
|
: super(i0.TableManagerState(
|
||||||
|
db: db,
|
||||||
|
table: table,
|
||||||
|
createFilteringComposer: () =>
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableFilterComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
createOrderingComposer: () =>
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableOrderingComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
createComputedFieldComposer: () =>
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableAnnotationComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
updateCompanionCallback: ({
|
||||||
|
i0.Value<String> assetId = const i0.Value.absent(),
|
||||||
|
i0.Value<String> albumId = const i0.Value.absent(),
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumAssetEntityCompanion(
|
||||||
|
assetId: assetId,
|
||||||
|
albumId: albumId,
|
||||||
|
),
|
||||||
|
createCompanionCallback: ({
|
||||||
|
required String assetId,
|
||||||
|
required String albumId,
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumAssetEntityCompanion.insert(
|
||||||
|
assetId: assetId,
|
||||||
|
albumId: albumId,
|
||||||
|
),
|
||||||
|
withReferenceMapper: (p0) => p0
|
||||||
|
.map((e) => (
|
||||||
|
e.readTable(table),
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableReferences(db, table, e)
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
prefetchHooksCallback: ({assetId = false, albumId = 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.$$RemoteAlbumAssetEntityTableReferences
|
||||||
|
._assetIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumAssetEntityTableReferences
|
||||||
|
._assetIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
if (albumId) {
|
||||||
|
state = state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.albumId,
|
||||||
|
referencedTable: i1.$$RemoteAlbumAssetEntityTableReferences
|
||||||
|
._albumIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumAssetEntityTableReferences
|
||||||
|
._albumIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
getPrefetchedDataCallback: (items) async {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumAssetEntityTableProcessedTableManager
|
||||||
|
= i0.ProcessedTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumAssetEntityTable,
|
||||||
|
i1.RemoteAlbumAssetEntityData,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumAssetEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumAssetEntityTableUpdateCompanionBuilder,
|
||||||
|
(
|
||||||
|
i1.RemoteAlbumAssetEntityData,
|
||||||
|
i1.$$RemoteAlbumAssetEntityTableReferences
|
||||||
|
),
|
||||||
|
i1.RemoteAlbumAssetEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool assetId, bool albumId})>;
|
||||||
|
|
||||||
|
class $RemoteAlbumAssetEntityTable extends i2.RemoteAlbumAssetEntity
|
||||||
|
with
|
||||||
|
i0.TableInfo<$RemoteAlbumAssetEntityTable,
|
||||||
|
i1.RemoteAlbumAssetEntityData> {
|
||||||
|
@override
|
||||||
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
$RemoteAlbumAssetEntityTable(this.attachedDatabase, [this._alias]);
|
||||||
|
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'));
|
||||||
|
static const i0.VerificationMeta _albumIdMeta =
|
||||||
|
const i0.VerificationMeta('albumId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> albumId = i0.GeneratedColumn<String>(
|
||||||
|
'album_id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES remote_album_entity (id) ON DELETE CASCADE'));
|
||||||
|
@override
|
||||||
|
List<i0.GeneratedColumn> get $columns => [assetId, albumId];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
|
@override
|
||||||
|
String get actualTableName => $name;
|
||||||
|
static const String $name = 'remote_album_asset_entity';
|
||||||
|
@override
|
||||||
|
i0.VerificationContext validateIntegrity(
|
||||||
|
i0.Insertable<i1.RemoteAlbumAssetEntityData> instance,
|
||||||
|
{bool isInserting = false}) {
|
||||||
|
final context = i0.VerificationContext();
|
||||||
|
final data = instance.toColumns(true);
|
||||||
|
if (data.containsKey('asset_id')) {
|
||||||
|
context.handle(_assetIdMeta,
|
||||||
|
assetId.isAcceptableOrUnknown(data['asset_id']!, _assetIdMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_assetIdMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('album_id')) {
|
||||||
|
context.handle(_albumIdMeta,
|
||||||
|
albumId.isAcceptableOrUnknown(data['album_id']!, _albumIdMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_albumIdMeta);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<i0.GeneratedColumn> get $primaryKey => {assetId, albumId};
|
||||||
|
@override
|
||||||
|
i1.RemoteAlbumAssetEntityData map(Map<String, dynamic> data,
|
||||||
|
{String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return i1.RemoteAlbumAssetEntityData(
|
||||||
|
assetId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}asset_id'])!,
|
||||||
|
albumId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}album_id'])!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
$RemoteAlbumAssetEntityTable createAlias(String alias) {
|
||||||
|
return $RemoteAlbumAssetEntityTable(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get withoutRowId => true;
|
||||||
|
@override
|
||||||
|
bool get isStrict => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumAssetEntityData extends i0.DataClass
|
||||||
|
implements i0.Insertable<i1.RemoteAlbumAssetEntityData> {
|
||||||
|
final String assetId;
|
||||||
|
final String albumId;
|
||||||
|
const RemoteAlbumAssetEntityData(
|
||||||
|
{required this.assetId, required this.albumId});
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
map['asset_id'] = i0.Variable<String>(assetId);
|
||||||
|
map['album_id'] = i0.Variable<String>(albumId);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory RemoteAlbumAssetEntityData.fromJson(Map<String, dynamic> json,
|
||||||
|
{i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return RemoteAlbumAssetEntityData(
|
||||||
|
assetId: serializer.fromJson<String>(json['assetId']),
|
||||||
|
albumId: serializer.fromJson<String>(json['albumId']),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'assetId': serializer.toJson<String>(assetId),
|
||||||
|
'albumId': serializer.toJson<String>(albumId),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumAssetEntityData copyWith({String? assetId, String? albumId}) =>
|
||||||
|
i1.RemoteAlbumAssetEntityData(
|
||||||
|
assetId: assetId ?? this.assetId,
|
||||||
|
albumId: albumId ?? this.albumId,
|
||||||
|
);
|
||||||
|
RemoteAlbumAssetEntityData copyWithCompanion(
|
||||||
|
i1.RemoteAlbumAssetEntityCompanion data) {
|
||||||
|
return RemoteAlbumAssetEntityData(
|
||||||
|
assetId: data.assetId.present ? data.assetId.value : this.assetId,
|
||||||
|
albumId: data.albumId.present ? data.albumId.value : this.albumId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumAssetEntityData(')
|
||||||
|
..write('assetId: $assetId, ')
|
||||||
|
..write('albumId: $albumId')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(assetId, albumId);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is i1.RemoteAlbumAssetEntityData &&
|
||||||
|
other.assetId == this.assetId &&
|
||||||
|
other.albumId == this.albumId);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumAssetEntityCompanion
|
||||||
|
extends i0.UpdateCompanion<i1.RemoteAlbumAssetEntityData> {
|
||||||
|
final i0.Value<String> assetId;
|
||||||
|
final i0.Value<String> albumId;
|
||||||
|
const RemoteAlbumAssetEntityCompanion({
|
||||||
|
this.assetId = const i0.Value.absent(),
|
||||||
|
this.albumId = const i0.Value.absent(),
|
||||||
|
});
|
||||||
|
RemoteAlbumAssetEntityCompanion.insert({
|
||||||
|
required String assetId,
|
||||||
|
required String albumId,
|
||||||
|
}) : assetId = i0.Value(assetId),
|
||||||
|
albumId = i0.Value(albumId);
|
||||||
|
static i0.Insertable<i1.RemoteAlbumAssetEntityData> custom({
|
||||||
|
i0.Expression<String>? assetId,
|
||||||
|
i0.Expression<String>? albumId,
|
||||||
|
}) {
|
||||||
|
return i0.RawValuesInsertable({
|
||||||
|
if (assetId != null) 'asset_id': assetId,
|
||||||
|
if (albumId != null) 'album_id': albumId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumAssetEntityCompanion copyWith(
|
||||||
|
{i0.Value<String>? assetId, i0.Value<String>? albumId}) {
|
||||||
|
return i1.RemoteAlbumAssetEntityCompanion(
|
||||||
|
assetId: assetId ?? this.assetId,
|
||||||
|
albumId: albumId ?? this.albumId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
if (assetId.present) {
|
||||||
|
map['asset_id'] = i0.Variable<String>(assetId.value);
|
||||||
|
}
|
||||||
|
if (albumId.present) {
|
||||||
|
map['album_id'] = i0.Variable<String>(albumId.value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumAssetEntityCompanion(')
|
||||||
|
..write('assetId: $assetId, ')
|
||||||
|
..write('albumId: $albumId')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
|
|
||||||
|
class RemoteAlbumUserEntity extends Table with DriftDefaultsMixin {
|
||||||
|
const RemoteAlbumUserEntity();
|
||||||
|
|
||||||
|
TextColumn get albumId =>
|
||||||
|
text().references(RemoteAlbumEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
TextColumn get userId =>
|
||||||
|
text().references(UserEntity, #id, onDelete: KeyAction.cascade)();
|
||||||
|
|
||||||
|
IntColumn get role => intEnum<AlbumUserRole>()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column> get primaryKey => {albumId, userId};
|
||||||
|
}
|
618
mobile/lib/infrastructure/entities/remote_album_user.entity.drift.dart
generated
Normal file
618
mobile/lib/infrastructure/entities/remote_album_user.entity.drift.dart
generated
Normal file
@ -0,0 +1,618 @@
|
|||||||
|
// dart format width=80
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
import 'package:drift/drift.dart' as i0;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
||||||
|
as i1;
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.model.dart' as i2;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.dart'
|
||||||
|
as i3;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
|
as i4;
|
||||||
|
import 'package:drift/internal/modular.dart' as i5;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart'
|
||||||
|
as i6;
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumUserEntityTableCreateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumUserEntityCompanion Function({
|
||||||
|
required String albumId,
|
||||||
|
required String userId,
|
||||||
|
required i2.AlbumUserRole role,
|
||||||
|
});
|
||||||
|
typedef $$RemoteAlbumUserEntityTableUpdateCompanionBuilder
|
||||||
|
= i1.RemoteAlbumUserEntityCompanion Function({
|
||||||
|
i0.Value<String> albumId,
|
||||||
|
i0.Value<String> userId,
|
||||||
|
i0.Value<i2.AlbumUserRole> role,
|
||||||
|
});
|
||||||
|
|
||||||
|
final class $$RemoteAlbumUserEntityTableReferences extends i0.BaseReferences<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumUserEntityTable,
|
||||||
|
i1.RemoteAlbumUserEntityData> {
|
||||||
|
$$RemoteAlbumUserEntityTableReferences(
|
||||||
|
super.$_db, super.$_table, super.$_typedResult);
|
||||||
|
|
||||||
|
static i4.$RemoteAlbumEntityTable _albumIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumUserEntityTable>(
|
||||||
|
'remote_album_user_entity')
|
||||||
|
.albumId,
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i4.$$RemoteAlbumEntityTableProcessedTableManager get albumId {
|
||||||
|
final $_column = $_itemColumn<String>('album_id')!;
|
||||||
|
|
||||||
|
final manager = i4
|
||||||
|
.$$RemoteAlbumEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i5.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity'))
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_albumIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]));
|
||||||
|
}
|
||||||
|
|
||||||
|
static i6.$UserEntityTable _userIdTable(i0.GeneratedDatabase db) =>
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity')
|
||||||
|
.createAlias(i0.$_aliasNameGenerator(
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i1.$RemoteAlbumUserEntityTable>(
|
||||||
|
'remote_album_user_entity')
|
||||||
|
.userId,
|
||||||
|
i5.ReadDatabaseContainer(db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity')
|
||||||
|
.id));
|
||||||
|
|
||||||
|
i6.$$UserEntityTableProcessedTableManager get userId {
|
||||||
|
final $_column = $_itemColumn<String>('user_id')!;
|
||||||
|
|
||||||
|
final manager = i6
|
||||||
|
.$$UserEntityTableTableManager(
|
||||||
|
$_db,
|
||||||
|
i5.ReadDatabaseContainer($_db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'))
|
||||||
|
.filter((f) => f.id.sqlEquals($_column));
|
||||||
|
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
||||||
|
if (item == null) return manager;
|
||||||
|
return i0.ProcessedTableManager(
|
||||||
|
manager.$state.copyWith(prefetchedData: [item]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumUserEntityTableFilterComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumUserEntityTable> {
|
||||||
|
$$RemoteAlbumUserEntityTableFilterComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnWithTypeConverterFilters<i2.AlbumUserRole, i2.AlbumUserRole, int>
|
||||||
|
get role => $composableBuilder(
|
||||||
|
column: $table.role,
|
||||||
|
builder: (column) => i0.ColumnWithTypeConverterFilters(column));
|
||||||
|
|
||||||
|
i4.$$RemoteAlbumEntityTableFilterComposer get albumId {
|
||||||
|
final i4.$$RemoteAlbumEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i4.$$RemoteAlbumEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i6.$$UserEntityTableFilterComposer get userId {
|
||||||
|
final i6.$$UserEntityTableFilterComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.userId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i6.$$UserEntityTableFilterComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumUserEntityTableOrderingComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumUserEntityTable> {
|
||||||
|
$$RemoteAlbumUserEntityTableOrderingComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.ColumnOrderings<int> get role => $composableBuilder(
|
||||||
|
column: $table.role, builder: (column) => i0.ColumnOrderings(column));
|
||||||
|
|
||||||
|
i4.$$RemoteAlbumEntityTableOrderingComposer get albumId {
|
||||||
|
final i4.$$RemoteAlbumEntityTableOrderingComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i4.$$RemoteAlbumEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>(
|
||||||
|
'remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i6.$$UserEntityTableOrderingComposer get userId {
|
||||||
|
final i6.$$UserEntityTableOrderingComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.userId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i6.$$UserEntityTableOrderingComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumUserEntityTableAnnotationComposer
|
||||||
|
extends i0.Composer<i0.GeneratedDatabase, i1.$RemoteAlbumUserEntityTable> {
|
||||||
|
$$RemoteAlbumUserEntityTableAnnotationComposer({
|
||||||
|
required super.$db,
|
||||||
|
required super.$table,
|
||||||
|
super.joinBuilder,
|
||||||
|
super.$addJoinBuilderToRootComposer,
|
||||||
|
super.$removeJoinBuilderFromRootComposer,
|
||||||
|
});
|
||||||
|
i0.GeneratedColumnWithTypeConverter<i2.AlbumUserRole, int> get role =>
|
||||||
|
$composableBuilder(column: $table.role, builder: (column) => column);
|
||||||
|
|
||||||
|
i4.$$RemoteAlbumEntityTableAnnotationComposer get albumId {
|
||||||
|
final i4.$$RemoteAlbumEntityTableAnnotationComposer composer =
|
||||||
|
$composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.albumId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>('remote_album_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i4.$$RemoteAlbumEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i4.$RemoteAlbumEntityTable>(
|
||||||
|
'remote_album_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
|
||||||
|
i6.$$UserEntityTableAnnotationComposer get userId {
|
||||||
|
final i6.$$UserEntityTableAnnotationComposer composer = $composerBuilder(
|
||||||
|
composer: this,
|
||||||
|
getCurrentColumn: (t) => t.userId,
|
||||||
|
referencedTable: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
getReferencedColumn: (t) => t.id,
|
||||||
|
builder: (joinBuilder,
|
||||||
|
{$addJoinBuilderToRootComposer,
|
||||||
|
$removeJoinBuilderFromRootComposer}) =>
|
||||||
|
i6.$$UserEntityTableAnnotationComposer(
|
||||||
|
$db: $db,
|
||||||
|
$table: i5.ReadDatabaseContainer($db)
|
||||||
|
.resultSet<i6.$UserEntityTable>('user_entity'),
|
||||||
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
||||||
|
joinBuilder: joinBuilder,
|
||||||
|
$removeJoinBuilderFromRootComposer:
|
||||||
|
$removeJoinBuilderFromRootComposer,
|
||||||
|
));
|
||||||
|
return composer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class $$RemoteAlbumUserEntityTableTableManager extends i0.RootTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumUserEntityTable,
|
||||||
|
i1.RemoteAlbumUserEntityData,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumUserEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumUserEntityTableUpdateCompanionBuilder,
|
||||||
|
(i1.RemoteAlbumUserEntityData, i1.$$RemoteAlbumUserEntityTableReferences),
|
||||||
|
i1.RemoteAlbumUserEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool albumId, bool userId})> {
|
||||||
|
$$RemoteAlbumUserEntityTableTableManager(
|
||||||
|
i0.GeneratedDatabase db, i1.$RemoteAlbumUserEntityTable table)
|
||||||
|
: super(i0.TableManagerState(
|
||||||
|
db: db,
|
||||||
|
table: table,
|
||||||
|
createFilteringComposer: () =>
|
||||||
|
i1.$$RemoteAlbumUserEntityTableFilterComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
createOrderingComposer: () =>
|
||||||
|
i1.$$RemoteAlbumUserEntityTableOrderingComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
createComputedFieldComposer: () =>
|
||||||
|
i1.$$RemoteAlbumUserEntityTableAnnotationComposer(
|
||||||
|
$db: db, $table: table),
|
||||||
|
updateCompanionCallback: ({
|
||||||
|
i0.Value<String> albumId = const i0.Value.absent(),
|
||||||
|
i0.Value<String> userId = const i0.Value.absent(),
|
||||||
|
i0.Value<i2.AlbumUserRole> role = const i0.Value.absent(),
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumUserEntityCompanion(
|
||||||
|
albumId: albumId,
|
||||||
|
userId: userId,
|
||||||
|
role: role,
|
||||||
|
),
|
||||||
|
createCompanionCallback: ({
|
||||||
|
required String albumId,
|
||||||
|
required String userId,
|
||||||
|
required i2.AlbumUserRole role,
|
||||||
|
}) =>
|
||||||
|
i1.RemoteAlbumUserEntityCompanion.insert(
|
||||||
|
albumId: albumId,
|
||||||
|
userId: userId,
|
||||||
|
role: role,
|
||||||
|
),
|
||||||
|
withReferenceMapper: (p0) => p0
|
||||||
|
.map((e) => (
|
||||||
|
e.readTable(table),
|
||||||
|
i1.$$RemoteAlbumUserEntityTableReferences(db, table, e)
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
prefetchHooksCallback: ({albumId = false, userId = 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 (albumId) {
|
||||||
|
state = state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.albumId,
|
||||||
|
referencedTable: i1.$$RemoteAlbumUserEntityTableReferences
|
||||||
|
._albumIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumUserEntityTableReferences
|
||||||
|
._albumIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
if (userId) {
|
||||||
|
state = state.withJoin(
|
||||||
|
currentTable: table,
|
||||||
|
currentColumn: table.userId,
|
||||||
|
referencedTable: i1.$$RemoteAlbumUserEntityTableReferences
|
||||||
|
._userIdTable(db),
|
||||||
|
referencedColumn: i1.$$RemoteAlbumUserEntityTableReferences
|
||||||
|
._userIdTable(db)
|
||||||
|
.id,
|
||||||
|
) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
getPrefetchedDataCallback: (items) async {
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef $$RemoteAlbumUserEntityTableProcessedTableManager
|
||||||
|
= i0.ProcessedTableManager<
|
||||||
|
i0.GeneratedDatabase,
|
||||||
|
i1.$RemoteAlbumUserEntityTable,
|
||||||
|
i1.RemoteAlbumUserEntityData,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableFilterComposer,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableOrderingComposer,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableAnnotationComposer,
|
||||||
|
$$RemoteAlbumUserEntityTableCreateCompanionBuilder,
|
||||||
|
$$RemoteAlbumUserEntityTableUpdateCompanionBuilder,
|
||||||
|
(
|
||||||
|
i1.RemoteAlbumUserEntityData,
|
||||||
|
i1.$$RemoteAlbumUserEntityTableReferences
|
||||||
|
),
|
||||||
|
i1.RemoteAlbumUserEntityData,
|
||||||
|
i0.PrefetchHooks Function({bool albumId, bool userId})>;
|
||||||
|
|
||||||
|
class $RemoteAlbumUserEntityTable extends i3.RemoteAlbumUserEntity
|
||||||
|
with
|
||||||
|
i0
|
||||||
|
.TableInfo<$RemoteAlbumUserEntityTable, i1.RemoteAlbumUserEntityData> {
|
||||||
|
@override
|
||||||
|
final i0.GeneratedDatabase attachedDatabase;
|
||||||
|
final String? _alias;
|
||||||
|
$RemoteAlbumUserEntityTable(this.attachedDatabase, [this._alias]);
|
||||||
|
static const i0.VerificationMeta _albumIdMeta =
|
||||||
|
const i0.VerificationMeta('albumId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> albumId = i0.GeneratedColumn<String>(
|
||||||
|
'album_id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES remote_album_entity (id) ON DELETE CASCADE'));
|
||||||
|
static const i0.VerificationMeta _userIdMeta =
|
||||||
|
const i0.VerificationMeta('userId');
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumn<String> userId = i0.GeneratedColumn<String>(
|
||||||
|
'user_id', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.string,
|
||||||
|
requiredDuringInsert: true,
|
||||||
|
defaultConstraints: i0.GeneratedColumn.constraintIsAlways(
|
||||||
|
'REFERENCES user_entity (id) ON DELETE CASCADE'));
|
||||||
|
@override
|
||||||
|
late final i0.GeneratedColumnWithTypeConverter<i2.AlbumUserRole, int> role =
|
||||||
|
i0.GeneratedColumn<int>('role', aliasedName, false,
|
||||||
|
type: i0.DriftSqlType.int, requiredDuringInsert: true)
|
||||||
|
.withConverter<i2.AlbumUserRole>(
|
||||||
|
i1.$RemoteAlbumUserEntityTable.$converterrole);
|
||||||
|
@override
|
||||||
|
List<i0.GeneratedColumn> get $columns => [albumId, userId, role];
|
||||||
|
@override
|
||||||
|
String get aliasedName => _alias ?? actualTableName;
|
||||||
|
@override
|
||||||
|
String get actualTableName => $name;
|
||||||
|
static const String $name = 'remote_album_user_entity';
|
||||||
|
@override
|
||||||
|
i0.VerificationContext validateIntegrity(
|
||||||
|
i0.Insertable<i1.RemoteAlbumUserEntityData> instance,
|
||||||
|
{bool isInserting = false}) {
|
||||||
|
final context = i0.VerificationContext();
|
||||||
|
final data = instance.toColumns(true);
|
||||||
|
if (data.containsKey('album_id')) {
|
||||||
|
context.handle(_albumIdMeta,
|
||||||
|
albumId.isAcceptableOrUnknown(data['album_id']!, _albumIdMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_albumIdMeta);
|
||||||
|
}
|
||||||
|
if (data.containsKey('user_id')) {
|
||||||
|
context.handle(_userIdMeta,
|
||||||
|
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta));
|
||||||
|
} else if (isInserting) {
|
||||||
|
context.missing(_userIdMeta);
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<i0.GeneratedColumn> get $primaryKey => {albumId, userId};
|
||||||
|
@override
|
||||||
|
i1.RemoteAlbumUserEntityData map(Map<String, dynamic> data,
|
||||||
|
{String? tablePrefix}) {
|
||||||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||||
|
return i1.RemoteAlbumUserEntityData(
|
||||||
|
albumId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}album_id'])!,
|
||||||
|
userId: attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.string, data['${effectivePrefix}user_id'])!,
|
||||||
|
role: i1.$RemoteAlbumUserEntityTable.$converterrole.fromSql(
|
||||||
|
attachedDatabase.typeMapping
|
||||||
|
.read(i0.DriftSqlType.int, data['${effectivePrefix}role'])!),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
$RemoteAlbumUserEntityTable createAlias(String alias) {
|
||||||
|
return $RemoteAlbumUserEntityTable(attachedDatabase, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
static i0.JsonTypeConverter2<i2.AlbumUserRole, int, int> $converterrole =
|
||||||
|
const i0.EnumIndexConverter<i2.AlbumUserRole>(i2.AlbumUserRole.values);
|
||||||
|
@override
|
||||||
|
bool get withoutRowId => true;
|
||||||
|
@override
|
||||||
|
bool get isStrict => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumUserEntityData extends i0.DataClass
|
||||||
|
implements i0.Insertable<i1.RemoteAlbumUserEntityData> {
|
||||||
|
final String albumId;
|
||||||
|
final String userId;
|
||||||
|
final i2.AlbumUserRole role;
|
||||||
|
const RemoteAlbumUserEntityData(
|
||||||
|
{required this.albumId, required this.userId, required this.role});
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
map['album_id'] = i0.Variable<String>(albumId);
|
||||||
|
map['user_id'] = i0.Variable<String>(userId);
|
||||||
|
{
|
||||||
|
map['role'] = i0.Variable<int>(
|
||||||
|
i1.$RemoteAlbumUserEntityTable.$converterrole.toSql(role));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
factory RemoteAlbumUserEntityData.fromJson(Map<String, dynamic> json,
|
||||||
|
{i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return RemoteAlbumUserEntityData(
|
||||||
|
albumId: serializer.fromJson<String>(json['albumId']),
|
||||||
|
userId: serializer.fromJson<String>(json['userId']),
|
||||||
|
role: i1.$RemoteAlbumUserEntityTable.$converterrole
|
||||||
|
.fromJson(serializer.fromJson<int>(json['role'])),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||||
|
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||||
|
return <String, dynamic>{
|
||||||
|
'albumId': serializer.toJson<String>(albumId),
|
||||||
|
'userId': serializer.toJson<String>(userId),
|
||||||
|
'role': serializer.toJson<int>(
|
||||||
|
i1.$RemoteAlbumUserEntityTable.$converterrole.toJson(role)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumUserEntityData copyWith(
|
||||||
|
{String? albumId, String? userId, i2.AlbumUserRole? role}) =>
|
||||||
|
i1.RemoteAlbumUserEntityData(
|
||||||
|
albumId: albumId ?? this.albumId,
|
||||||
|
userId: userId ?? this.userId,
|
||||||
|
role: role ?? this.role,
|
||||||
|
);
|
||||||
|
RemoteAlbumUserEntityData copyWithCompanion(
|
||||||
|
i1.RemoteAlbumUserEntityCompanion data) {
|
||||||
|
return RemoteAlbumUserEntityData(
|
||||||
|
albumId: data.albumId.present ? data.albumId.value : this.albumId,
|
||||||
|
userId: data.userId.present ? data.userId.value : this.userId,
|
||||||
|
role: data.role.present ? data.role.value : this.role,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumUserEntityData(')
|
||||||
|
..write('albumId: $albumId, ')
|
||||||
|
..write('userId: $userId, ')
|
||||||
|
..write('role: $role')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(albumId, userId, role);
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
(other is i1.RemoteAlbumUserEntityData &&
|
||||||
|
other.albumId == this.albumId &&
|
||||||
|
other.userId == this.userId &&
|
||||||
|
other.role == this.role);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteAlbumUserEntityCompanion
|
||||||
|
extends i0.UpdateCompanion<i1.RemoteAlbumUserEntityData> {
|
||||||
|
final i0.Value<String> albumId;
|
||||||
|
final i0.Value<String> userId;
|
||||||
|
final i0.Value<i2.AlbumUserRole> role;
|
||||||
|
const RemoteAlbumUserEntityCompanion({
|
||||||
|
this.albumId = const i0.Value.absent(),
|
||||||
|
this.userId = const i0.Value.absent(),
|
||||||
|
this.role = const i0.Value.absent(),
|
||||||
|
});
|
||||||
|
RemoteAlbumUserEntityCompanion.insert({
|
||||||
|
required String albumId,
|
||||||
|
required String userId,
|
||||||
|
required i2.AlbumUserRole role,
|
||||||
|
}) : albumId = i0.Value(albumId),
|
||||||
|
userId = i0.Value(userId),
|
||||||
|
role = i0.Value(role);
|
||||||
|
static i0.Insertable<i1.RemoteAlbumUserEntityData> custom({
|
||||||
|
i0.Expression<String>? albumId,
|
||||||
|
i0.Expression<String>? userId,
|
||||||
|
i0.Expression<int>? role,
|
||||||
|
}) {
|
||||||
|
return i0.RawValuesInsertable({
|
||||||
|
if (albumId != null) 'album_id': albumId,
|
||||||
|
if (userId != null) 'user_id': userId,
|
||||||
|
if (role != null) 'role': role,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i1.RemoteAlbumUserEntityCompanion copyWith(
|
||||||
|
{i0.Value<String>? albumId,
|
||||||
|
i0.Value<String>? userId,
|
||||||
|
i0.Value<i2.AlbumUserRole>? role}) {
|
||||||
|
return i1.RemoteAlbumUserEntityCompanion(
|
||||||
|
albumId: albumId ?? this.albumId,
|
||||||
|
userId: userId ?? this.userId,
|
||||||
|
role: role ?? this.role,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||||
|
final map = <String, i0.Expression>{};
|
||||||
|
if (albumId.present) {
|
||||||
|
map['album_id'] = i0.Variable<String>(albumId.value);
|
||||||
|
}
|
||||||
|
if (userId.present) {
|
||||||
|
map['user_id'] = i0.Variable<String>(userId.value);
|
||||||
|
}
|
||||||
|
if (role.present) {
|
||||||
|
map['role'] = i0.Variable<int>(
|
||||||
|
i1.$RemoteAlbumUserEntityTable.$converterrole.toSql(role.value));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return (StringBuffer('RemoteAlbumUserEntityCompanion(')
|
||||||
|
..write('albumId: $albumId, ')
|
||||||
|
..write('userId: $userId, ')
|
||||||
|
..write('role: $role')
|
||||||
|
..write(')'))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.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/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/asset.mixin.dart';
|
||||||
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
import 'package:immich_mobile/infrastructure/utils/drift_default.mixin.dart';
|
||||||
@ -34,3 +35,21 @@ class RemoteAssetEntity extends Table
|
|||||||
@override
|
@override
|
||||||
Set<Column> get primaryKey => {id};
|
Set<Column> get primaryKey => {id};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
||||||
|
Asset toDto() => Asset(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
checksum: checksum,
|
||||||
|
type: type,
|
||||||
|
createdAt: createdAt,
|
||||||
|
updatedAt: updatedAt,
|
||||||
|
durationInSeconds: durationInSeconds,
|
||||||
|
isFavorite: isFavorite,
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
thumbHash: thumbHash,
|
||||||
|
visibility: visibility,
|
||||||
|
localId: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -8,6 +8,9 @@ import 'package:immich_mobile/infrastructure/entities/local_album.entity.dart';
|
|||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/partner.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.dart';
|
||||||
@ -40,6 +43,9 @@ class IsarDatabaseRepository implements IDatabaseRepository {
|
|||||||
LocalAlbumAssetEntity,
|
LocalAlbumAssetEntity,
|
||||||
RemoteAssetEntity,
|
RemoteAssetEntity,
|
||||||
RemoteExifEntity,
|
RemoteExifEntity,
|
||||||
|
RemoteAlbumEntity,
|
||||||
|
RemoteAlbumAssetEntity,
|
||||||
|
RemoteAlbumUserEntity,
|
||||||
],
|
],
|
||||||
include: {
|
include: {
|
||||||
'package:immich_mobile/infrastructure/entities/merged_asset.drift',
|
'package:immich_mobile/infrastructure/entities/merged_asset.drift',
|
||||||
|
@ -17,9 +17,15 @@ import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.d
|
|||||||
as i7;
|
as i7;
|
||||||
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart'
|
||||||
as i8;
|
as i8;
|
||||||
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart'
|
||||||
as i9;
|
as i9;
|
||||||
import 'package:drift/internal/modular.dart' as i10;
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart'
|
||||||
|
as i10;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart'
|
||||||
|
as i11;
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/merged_asset.drift.dart'
|
||||||
|
as i12;
|
||||||
|
import 'package:drift/internal/modular.dart' as i13;
|
||||||
|
|
||||||
abstract class $Drift extends i0.GeneratedDatabase {
|
abstract class $Drift extends i0.GeneratedDatabase {
|
||||||
$Drift(i0.QueryExecutor e) : super(e);
|
$Drift(i0.QueryExecutor e) : super(e);
|
||||||
@ -39,8 +45,14 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
i7.$LocalAlbumAssetEntityTable(this);
|
i7.$LocalAlbumAssetEntityTable(this);
|
||||||
late final i8.$RemoteExifEntityTable remoteExifEntity =
|
late final i8.$RemoteExifEntityTable remoteExifEntity =
|
||||||
i8.$RemoteExifEntityTable(this);
|
i8.$RemoteExifEntityTable(this);
|
||||||
i9.MergedAssetDrift get mergedAssetDrift => i10.ReadDatabaseContainer(this)
|
late final i9.$RemoteAlbumEntityTable remoteAlbumEntity =
|
||||||
.accessor<i9.MergedAssetDrift>(i9.MergedAssetDrift.new);
|
i9.$RemoteAlbumEntityTable(this);
|
||||||
|
late final i10.$RemoteAlbumAssetEntityTable remoteAlbumAssetEntity =
|
||||||
|
i10.$RemoteAlbumAssetEntityTable(this);
|
||||||
|
late final i11.$RemoteAlbumUserEntityTable remoteAlbumUserEntity =
|
||||||
|
i11.$RemoteAlbumUserEntityTable(this);
|
||||||
|
i12.MergedAssetDrift get mergedAssetDrift => i13.ReadDatabaseContainer(this)
|
||||||
|
.accessor<i12.MergedAssetDrift>(i12.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?>>();
|
||||||
@ -56,7 +68,10 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
partnerEntity,
|
partnerEntity,
|
||||||
localAlbumEntity,
|
localAlbumEntity,
|
||||||
localAlbumAssetEntity,
|
localAlbumAssetEntity,
|
||||||
remoteExifEntity
|
remoteExifEntity,
|
||||||
|
remoteAlbumEntity,
|
||||||
|
remoteAlbumAssetEntity,
|
||||||
|
remoteAlbumUserEntity
|
||||||
];
|
];
|
||||||
@override
|
@override
|
||||||
i0.StreamQueryUpdateRules get streamUpdateRules =>
|
i0.StreamQueryUpdateRules get streamUpdateRules =>
|
||||||
@ -114,6 +129,52 @@ abstract class $Drift extends i0.GeneratedDatabase {
|
|||||||
i0.TableUpdate('remote_exif_entity', kind: i0.UpdateKind.delete),
|
i0.TableUpdate('remote_exif_entity', kind: i0.UpdateKind.delete),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('user_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_entity', kind: i0.UpdateKind.delete),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('remote_asset_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_entity', kind: i0.UpdateKind.update),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('remote_asset_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_asset_entity',
|
||||||
|
kind: i0.UpdateKind.delete),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('remote_album_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_asset_entity',
|
||||||
|
kind: i0.UpdateKind.delete),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('remote_album_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_user_entity',
|
||||||
|
kind: i0.UpdateKind.delete),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
i0.WritePropagation(
|
||||||
|
on: i0.TableUpdateQuery.onTableName('user_entity',
|
||||||
|
limitUpdateKind: i0.UpdateKind.delete),
|
||||||
|
result: [
|
||||||
|
i0.TableUpdate('remote_album_user_entity',
|
||||||
|
kind: i0.UpdateKind.delete),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@override
|
@override
|
||||||
@ -140,4 +201,11 @@ class $DriftManager {
|
|||||||
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
.$$LocalAlbumAssetEntityTableTableManager(_db, _db.localAlbumAssetEntity);
|
||||||
i8.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
i8.$$RemoteExifEntityTableTableManager get remoteExifEntity =>
|
||||||
i8.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
i8.$$RemoteExifEntityTableTableManager(_db, _db.remoteExifEntity);
|
||||||
|
i9.$$RemoteAlbumEntityTableTableManager get remoteAlbumEntity =>
|
||||||
|
i9.$$RemoteAlbumEntityTableTableManager(_db, _db.remoteAlbumEntity);
|
||||||
|
i10.$$RemoteAlbumAssetEntityTableTableManager get remoteAlbumAssetEntity =>
|
||||||
|
i10.$$RemoteAlbumAssetEntityTableTableManager(
|
||||||
|
_db, _db.remoteAlbumAssetEntity);
|
||||||
|
i11.$$RemoteAlbumUserEntityTableTableManager get remoteAlbumUserEntity => i11
|
||||||
|
.$$RemoteAlbumUserEntityTableTableManager(_db, _db.remoteAlbumUserEntity);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/local_album.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/local_album.model.dart';
|
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_album.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.drift.dart';
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
|
|
||||||
|
enum SortRemoteAlbumsBy { id }
|
||||||
|
|
||||||
|
class DriftRemoteAlbumRepository extends DriftDatabaseRepository {
|
||||||
|
final Drift _db;
|
||||||
|
const DriftRemoteAlbumRepository(this._db) : super(_db);
|
||||||
|
|
||||||
|
Future<List<Album>> getAll({Set<SortRemoteAlbumsBy> sortBy = const {}}) {
|
||||||
|
final query = _db.remoteAlbumEntity.select();
|
||||||
|
|
||||||
|
if (sortBy.isNotEmpty) {
|
||||||
|
final orderings = <OrderClauseGenerator<$RemoteAlbumEntityTable>>[];
|
||||||
|
for (final sort in sortBy) {
|
||||||
|
orderings.add(
|
||||||
|
switch (sort) {
|
||||||
|
SortRemoteAlbumsBy.id => (row) => OrderingTerm.asc(row.id),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
query.orderBy(orderings);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query.map((row) => row.toDto()).get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension on RemoteAlbumEntityData {
|
||||||
|
Album toDto() {
|
||||||
|
return Album(
|
||||||
|
id: id,
|
||||||
|
name: name,
|
||||||
|
ownerId: ownerId,
|
||||||
|
createdAt: createdAt,
|
||||||
|
updatedAt: updatedAt,
|
||||||
|
description: description,
|
||||||
|
thumbnailAssetId: thumbnailAssetId,
|
||||||
|
isActivityEnabled: isActivityEnabled,
|
||||||
|
order: order,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -42,11 +42,16 @@ class SyncApiRepository {
|
|||||||
SyncStreamDto(
|
SyncStreamDto(
|
||||||
types: [
|
types: [
|
||||||
SyncRequestType.usersV1,
|
SyncRequestType.usersV1,
|
||||||
SyncRequestType.partnersV1,
|
|
||||||
SyncRequestType.assetsV1,
|
SyncRequestType.assetsV1,
|
||||||
SyncRequestType.partnerAssetsV1,
|
|
||||||
SyncRequestType.assetExifsV1,
|
SyncRequestType.assetExifsV1,
|
||||||
|
SyncRequestType.partnersV1,
|
||||||
|
SyncRequestType.partnerAssetsV1,
|
||||||
SyncRequestType.partnerAssetExifsV1,
|
SyncRequestType.partnerAssetExifsV1,
|
||||||
|
SyncRequestType.albumsV1,
|
||||||
|
SyncRequestType.albumUsersV1,
|
||||||
|
SyncRequestType.albumAssetsV1,
|
||||||
|
SyncRequestType.albumAssetExifsV1,
|
||||||
|
SyncRequestType.albumToAssetsV1,
|
||||||
],
|
],
|
||||||
).toJson(),
|
).toJson(),
|
||||||
);
|
);
|
||||||
@ -135,6 +140,25 @@ const _kResponseMap = <SyncEntityType, Function(Object)>{
|
|||||||
SyncEntityType.assetDeleteV1: SyncAssetDeleteV1.fromJson,
|
SyncEntityType.assetDeleteV1: SyncAssetDeleteV1.fromJson,
|
||||||
SyncEntityType.assetExifV1: SyncAssetExifV1.fromJson,
|
SyncEntityType.assetExifV1: SyncAssetExifV1.fromJson,
|
||||||
SyncEntityType.partnerAssetV1: SyncAssetV1.fromJson,
|
SyncEntityType.partnerAssetV1: SyncAssetV1.fromJson,
|
||||||
|
SyncEntityType.partnerAssetBackfillV1: SyncAssetV1.fromJson,
|
||||||
SyncEntityType.partnerAssetDeleteV1: SyncAssetDeleteV1.fromJson,
|
SyncEntityType.partnerAssetDeleteV1: SyncAssetDeleteV1.fromJson,
|
||||||
SyncEntityType.partnerAssetExifV1: SyncAssetExifV1.fromJson,
|
SyncEntityType.partnerAssetExifV1: SyncAssetExifV1.fromJson,
|
||||||
|
SyncEntityType.partnerAssetExifBackfillV1: SyncAssetExifV1.fromJson,
|
||||||
|
SyncEntityType.albumV1: SyncAlbumV1.fromJson,
|
||||||
|
SyncEntityType.albumDeleteV1: SyncAlbumDeleteV1.fromJson,
|
||||||
|
SyncEntityType.albumUserV1: SyncAlbumUserV1.fromJson,
|
||||||
|
SyncEntityType.albumUserBackfillV1: SyncAlbumUserV1.fromJson,
|
||||||
|
SyncEntityType.albumUserDeleteV1: SyncAlbumUserDeleteV1.fromJson,
|
||||||
|
SyncEntityType.albumAssetV1: SyncAssetV1.fromJson,
|
||||||
|
SyncEntityType.albumAssetBackfillV1: SyncAssetV1.fromJson,
|
||||||
|
SyncEntityType.albumAssetExifV1: SyncAssetExifV1.fromJson,
|
||||||
|
SyncEntityType.albumAssetExifBackfillV1: SyncAssetExifV1.fromJson,
|
||||||
|
SyncEntityType.albumToAssetV1: SyncAlbumToAssetV1.fromJson,
|
||||||
|
SyncEntityType.albumToAssetBackfillV1: SyncAlbumToAssetV1.fromJson,
|
||||||
|
SyncEntityType.albumToAssetDeleteV1: SyncAlbumToAssetDeleteV1.fromJson,
|
||||||
|
SyncEntityType.syncAckV1: _SyncAckV1.fromJson,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class _SyncAckV1 {
|
||||||
|
static _SyncAckV1? fromJson(dynamic _) => _SyncAckV1();
|
||||||
|
}
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/domain/models/album/album.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/infrastructure/entities/exif.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/exif.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/partner.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_asset.entity.drift.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_album_user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/user.entity.drift.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:openapi/api.dart' as api show AssetVisibility;
|
import 'package:openapi/api.dart' as api show AssetVisibility, AlbumUserRole;
|
||||||
import 'package:openapi/api.dart' hide AssetVisibility;
|
import 'package:openapi/api.dart' hide AssetVisibility, AlbumUserRole;
|
||||||
|
|
||||||
class SyncStreamRepository extends DriftDatabaseRepository {
|
class SyncStreamRepository extends DriftDatabaseRepository {
|
||||||
final Logger _logger = Logger('DriftSyncStreamRepository');
|
final Logger _logger = Logger('DriftSyncStreamRepository');
|
||||||
@ -17,16 +21,10 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
|
|
||||||
Future<void> deleteUsersV1(Iterable<SyncUserDeleteV1> data) async {
|
Future<void> deleteUsersV1(Iterable<SyncUserDeleteV1> data) async {
|
||||||
try {
|
try {
|
||||||
await _db.batch((batch) {
|
await _db.userEntity
|
||||||
for (final user in data) {
|
.deleteWhere((row) => row.id.isIn(data.map((e) => e.userId)));
|
||||||
batch.delete(
|
|
||||||
_db.userEntity,
|
|
||||||
UserEntityCompanion(id: Value(user.userId)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
_logger.severe('Error while processing SyncUserDeleteV1', error, stack);
|
_logger.severe('Error: SyncUserDeleteV1', error, stack);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +46,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error, stack) {
|
} catch (error, stack) {
|
||||||
_logger.severe('Error while processing SyncUserV1', error, stack);
|
_logger.severe('Error: SyncUserV1', error, stack);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +65,7 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
_logger.severe('Error while processing SyncPartnerDeleteV1', e, s);
|
_logger.severe('Error: SyncPartnerDeleteV1', e, s);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,67 +88,30 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
_logger.severe('Error while processing SyncPartnerV1', e, s);
|
_logger.severe('Error: SyncPartnerV1', e, s);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteAssetsV1(Iterable<SyncAssetDeleteV1> data) async {
|
Future<void> deleteAssetsV1(
|
||||||
|
Iterable<SyncAssetDeleteV1> data, {
|
||||||
|
String debugLabel = 'user',
|
||||||
|
}) async {
|
||||||
try {
|
try {
|
||||||
await _deleteAssetsV1(data);
|
await _db.remoteAssetEntity
|
||||||
|
.deleteWhere((row) => row.id.isIn(data.map((e) => e.assetId)));
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
_logger.severe('Error while processing deleteAssetsV1', e, s);
|
_logger.severe('Error: deleteAssetsV1 - $debugLabel', e, s);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateAssetsV1(Iterable<SyncAssetV1> data) async {
|
Future<void> updateAssetsV1(
|
||||||
|
Iterable<SyncAssetV1> data, {
|
||||||
|
String debugLabel = 'user',
|
||||||
|
}) async {
|
||||||
try {
|
try {
|
||||||
await _updateAssetsV1(data);
|
await _db.batch((batch) {
|
||||||
} catch (e, s) {
|
|
||||||
_logger.severe('Error while processing updateAssetsV1', e, s);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deletePartnerAssetsV1(Iterable<SyncAssetDeleteV1> data) async {
|
|
||||||
try {
|
|
||||||
await _deleteAssetsV1(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
_logger.severe('Error while processing deletePartnerAssetsV1', e, s);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updatePartnerAssetsV1(Iterable<SyncAssetV1> data) async {
|
|
||||||
try {
|
|
||||||
await _updateAssetsV1(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
_logger.severe('Error while processing updatePartnerAssetsV1', e, s);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updateAssetsExifV1(Iterable<SyncAssetExifV1> data) async {
|
|
||||||
try {
|
|
||||||
await _updateAssetExifV1(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
_logger.severe('Error while processing updateAssetsExifV1', e, s);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updatePartnerAssetsExifV1(Iterable<SyncAssetExifV1> data) async {
|
|
||||||
try {
|
|
||||||
await _updateAssetExifV1(data);
|
|
||||||
} catch (e, s) {
|
|
||||||
_logger.severe('Error while processing updatePartnerAssetsExifV1', e, s);
|
|
||||||
rethrow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _updateAssetsV1(Iterable<SyncAssetV1> data) =>
|
|
||||||
_db.batch((batch) {
|
|
||||||
for (final asset in data) {
|
for (final asset in data) {
|
||||||
final companion = RemoteAssetEntityCompanion(
|
final companion = RemoteAssetEntityCompanion(
|
||||||
name: Value(asset.originalFileName),
|
name: Value(asset.originalFileName),
|
||||||
@ -175,19 +136,18 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: updateAssetsV1 - $debugLabel', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _deleteAssetsV1(Iterable<SyncAssetDeleteV1> assets) =>
|
Future<void> updateAssetsExifV1(
|
||||||
_db.batch((batch) {
|
Iterable<SyncAssetExifV1> data, {
|
||||||
for (final asset in assets) {
|
String debugLabel = 'user',
|
||||||
batch.delete(
|
}) async {
|
||||||
_db.remoteAssetEntity,
|
try {
|
||||||
RemoteAssetEntityCompanion(id: Value(asset.assetId)),
|
await _db.batch((batch) {
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Future<void> _updateAssetExifV1(Iterable<SyncAssetExifV1> data) =>
|
|
||||||
_db.batch((batch) {
|
|
||||||
for (final exif in data) {
|
for (final exif in data) {
|
||||||
final companion = RemoteExifEntityCompanion(
|
final companion = RemoteExifEntityCompanion(
|
||||||
city: Value(exif.city),
|
city: Value(exif.city),
|
||||||
@ -219,6 +179,141 @@ class SyncStreamRepository extends DriftDatabaseRepository {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: updateAssetsExifV1 - $debugLabel', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAlbumsV1(Iterable<SyncAlbumDeleteV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.remoteAlbumEntity
|
||||||
|
.deleteWhere((row) => row.id.isIn(data.map((e) => e.albumId)));
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: deleteAlbumsV1', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateAlbumsV1(Iterable<SyncAlbumV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final album in data) {
|
||||||
|
final companion = RemoteAlbumEntityCompanion(
|
||||||
|
name: Value(album.name),
|
||||||
|
description: Value(album.description),
|
||||||
|
isActivityEnabled: Value(album.isActivityEnabled),
|
||||||
|
order: Value(album.order.toAlbumAssetOrder()),
|
||||||
|
thumbnailAssetId: Value(album.thumbnailAssetId),
|
||||||
|
ownerId: Value(album.ownerId),
|
||||||
|
createdAt: Value(album.createdAt),
|
||||||
|
updatedAt: Value(album.updatedAt),
|
||||||
|
);
|
||||||
|
|
||||||
|
batch.insert(
|
||||||
|
_db.remoteAlbumEntity,
|
||||||
|
companion.copyWith(id: Value(album.id)),
|
||||||
|
onConflict: DoUpdate((_) => companion),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: updateAlbumsV1', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAlbumUsersV1(Iterable<SyncAlbumUserDeleteV1> data) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final album in data) {
|
||||||
|
batch.delete(
|
||||||
|
_db.remoteAlbumUserEntity,
|
||||||
|
RemoteAlbumUserEntityCompanion(
|
||||||
|
albumId: Value(album.albumId),
|
||||||
|
userId: Value(album.userId),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: deleteAlbumUsersV1', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateAlbumUsersV1(
|
||||||
|
Iterable<SyncAlbumUserV1> data, {
|
||||||
|
String debugLabel = 'user',
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final album in data) {
|
||||||
|
final companion = RemoteAlbumUserEntityCompanion(
|
||||||
|
role: Value(album.role.toAlbumUserRole()),
|
||||||
|
);
|
||||||
|
|
||||||
|
batch.insert(
|
||||||
|
_db.remoteAlbumUserEntity,
|
||||||
|
companion.copyWith(
|
||||||
|
albumId: Value(album.albumId),
|
||||||
|
userId: Value(album.userId),
|
||||||
|
),
|
||||||
|
onConflict: DoUpdate((_) => companion),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: updateAlbumUsersV1 - $debugLabel', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAlbumToAssetsV1(
|
||||||
|
Iterable<SyncAlbumToAssetDeleteV1> data,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final album in data) {
|
||||||
|
batch.delete(
|
||||||
|
_db.remoteAlbumAssetEntity,
|
||||||
|
RemoteAlbumAssetEntityCompanion(
|
||||||
|
albumId: Value(album.albumId),
|
||||||
|
assetId: Value(album.assetId),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: deleteAlbumToAssetsV1', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateAlbumToAssetsV1(
|
||||||
|
Iterable<SyncAlbumToAssetV1> data, {
|
||||||
|
String debugLabel = 'user',
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
await _db.batch((batch) {
|
||||||
|
for (final album in data) {
|
||||||
|
final companion = RemoteAlbumAssetEntityCompanion(
|
||||||
|
albumId: Value(album.albumId),
|
||||||
|
assetId: Value(album.assetId),
|
||||||
|
);
|
||||||
|
|
||||||
|
batch.insert(
|
||||||
|
_db.remoteAlbumAssetEntity,
|
||||||
|
companion,
|
||||||
|
onConflict: DoNothing(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e, s) {
|
||||||
|
_logger.severe('Error: updateAlbumToAssetsV1 - $debugLabel', e, s);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on AssetTypeEnum {
|
extension on AssetTypeEnum {
|
||||||
@ -231,6 +326,22 @@ extension on AssetTypeEnum {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension on AssetOrder {
|
||||||
|
AlbumAssetOrder toAlbumAssetOrder() => switch (this) {
|
||||||
|
AssetOrder.asc => AlbumAssetOrder.asc,
|
||||||
|
AssetOrder.desc => AlbumAssetOrder.desc,
|
||||||
|
_ => throw Exception('Unknown AssetOrder value: $this'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extension on api.AlbumUserRole {
|
||||||
|
AlbumUserRole toAlbumUserRole() => switch (this) {
|
||||||
|
api.AlbumUserRole.editor => AlbumUserRole.editor,
|
||||||
|
api.AlbumUserRole.viewer => AlbumUserRole.viewer,
|
||||||
|
_ => throw Exception('Unknown AlbumUserRole value: $this'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
extension on api.AssetVisibility {
|
extension on api.AssetVisibility {
|
||||||
AssetVisibility toAssetVisibility() => switch (this) {
|
AssetVisibility toAssetVisibility() => switch (this) {
|
||||||
api.AssetVisibility.timeline => AssetVisibility.timeline,
|
api.AssetVisibility.timeline => AssetVisibility.timeline,
|
||||||
|
@ -6,6 +6,7 @@ import 'package:immich_mobile/constants/constants.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/timeline.model.dart';
|
import 'package:immich_mobile/domain/models/timeline.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:stream_transform/stream_transform.dart';
|
import 'package:stream_transform/stream_transform.dart';
|
||||||
|
|
||||||
@ -139,6 +140,62 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||||||
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Stream<List<Bucket>> watchRemoteBucket(
|
||||||
|
String albumId, {
|
||||||
|
GroupAssetsBy groupBy = GroupAssetsBy.day,
|
||||||
|
}) {
|
||||||
|
if (groupBy == GroupAssetsBy.none) {
|
||||||
|
return _db.remoteAlbumAssetEntity
|
||||||
|
.count(where: (row) => row.albumId.equals(albumId))
|
||||||
|
.map(_generateBuckets)
|
||||||
|
.watchSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
final assetCountExp = _db.remoteAssetEntity.id.count();
|
||||||
|
final dateExp = _db.remoteAssetEntity.createdAt.dateFmt(groupBy);
|
||||||
|
|
||||||
|
final query = _db.remoteAssetEntity.selectOnly()
|
||||||
|
..addColumns([assetCountExp, dateExp])
|
||||||
|
..join([
|
||||||
|
innerJoin(
|
||||||
|
_db.remoteAlbumAssetEntity,
|
||||||
|
_db.remoteAlbumAssetEntity.assetId
|
||||||
|
.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
),
|
||||||
|
])
|
||||||
|
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId))
|
||||||
|
..groupBy([dateExp])
|
||||||
|
..orderBy([OrderingTerm.desc(dateExp)]);
|
||||||
|
|
||||||
|
return query.map((row) {
|
||||||
|
final timeline = row.read(dateExp)!.dateFmt(groupBy);
|
||||||
|
final assetCount = row.read(assetCountExp)!;
|
||||||
|
return TimeBucket(date: timeline, assetCount: assetCount);
|
||||||
|
}).watch();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<BaseAsset>> getRemoteBucketAssets(
|
||||||
|
String albumId, {
|
||||||
|
required int offset,
|
||||||
|
required int count,
|
||||||
|
}) {
|
||||||
|
final query = _db.remoteAssetEntity.select().join(
|
||||||
|
[
|
||||||
|
innerJoin(
|
||||||
|
_db.remoteAlbumAssetEntity,
|
||||||
|
_db.remoteAlbumAssetEntity.assetId
|
||||||
|
.equalsExp(_db.remoteAssetEntity.id),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
..where(_db.remoteAlbumAssetEntity.albumId.equals(albumId))
|
||||||
|
..orderBy([OrderingTerm.desc(_db.remoteAssetEntity.createdAt)])
|
||||||
|
..limit(count, offset: offset);
|
||||||
|
return query
|
||||||
|
.map((row) => row.readTable(_db.remoteAssetEntity).toDto())
|
||||||
|
.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension on Expression<DateTime> {
|
extension on Expression<DateTime> {
|
||||||
|
@ -63,6 +63,9 @@ final _features = [
|
|||||||
final db = ref.read(driftProvider);
|
final db = ref.read(driftProvider);
|
||||||
await db.remoteAssetEntity.deleteAll();
|
await db.remoteAssetEntity.deleteAll();
|
||||||
await db.remoteExifEntity.deleteAll();
|
await db.remoteExifEntity.deleteAll();
|
||||||
|
await db.remoteAlbumEntity.deleteAll();
|
||||||
|
await db.remoteAlbumUserEntity.deleteAll();
|
||||||
|
await db.remoteAlbumAssetEntity.deleteAll();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
_Feature(
|
_Feature(
|
||||||
|
@ -40,7 +40,10 @@ class _Summary extends StatelessWidget {
|
|||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
subtitle = const Icon(Icons.error_rounded);
|
subtitle = const Icon(Icons.error_rounded);
|
||||||
} else {
|
} else {
|
||||||
subtitle = Text('${snapshot.data ?? 0}');
|
subtitle = Text(
|
||||||
|
'${snapshot.data ?? 0}',
|
||||||
|
style: ctx.textTheme.bodyLarge,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: leading,
|
leading: leading,
|
||||||
@ -147,6 +150,10 @@ final _remoteStats = [
|
|||||||
name: 'Exif Entities',
|
name: 'Exif Entities',
|
||||||
load: (db) => db.managers.remoteExifEntity.count(),
|
load: (db) => db.managers.remoteExifEntity.count(),
|
||||||
),
|
),
|
||||||
|
_Stat(
|
||||||
|
name: 'Remote Albums',
|
||||||
|
load: (db) => db.managers.remoteAlbumEntity.count(),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
@ -160,6 +167,7 @@ class RemoteMediaSummaryPage extends StatelessWidget {
|
|||||||
body: Consumer(
|
body: Consumer(
|
||||||
builder: (ctx, ref, __) {
|
builder: (ctx, ref, __) {
|
||||||
final db = ref.watch(driftProvider);
|
final db = ref.watch(driftProvider);
|
||||||
|
final albumsFuture = ref.watch(remoteAlbumRepository).getAll();
|
||||||
|
|
||||||
return CustomScrollView(
|
return CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
@ -171,6 +179,49 @@ class RemoteMediaSummaryPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
itemCount: _remoteStats.length,
|
itemCount: _remoteStats.length,
|
||||||
),
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
const Divider(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
|
child: Text(
|
||||||
|
"Album summary",
|
||||||
|
style: ctx.textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FutureBuilder(
|
||||||
|
future: albumsFuture,
|
||||||
|
builder: (_, snap) {
|
||||||
|
final albums = snap.data ?? [];
|
||||||
|
if (albums.isEmpty) {
|
||||||
|
return const SliverToBoxAdapter(child: SizedBox.shrink());
|
||||||
|
}
|
||||||
|
|
||||||
|
albums.sortBy((a) => a.name);
|
||||||
|
return SliverList.builder(
|
||||||
|
itemBuilder: (_, index) {
|
||||||
|
final album = albums[index];
|
||||||
|
final countFuture = db.managers.remoteAlbumAssetEntity
|
||||||
|
.filter((f) => f.albumId.id.equals(album.id))
|
||||||
|
.count();
|
||||||
|
return _Summary(
|
||||||
|
leading: const Icon(Icons.photo_album_rounded),
|
||||||
|
name: album.name,
|
||||||
|
countFuture: countFuture,
|
||||||
|
onTap: () => context.router.push(
|
||||||
|
RemoteTimelineRoute(albumId: album.id),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: albums.length,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
32
mobile/lib/presentation/pages/dev/remote_timeline.page.dart
Normal file
32
mobile/lib/presentation/pages/dev/remote_timeline.page.dart
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
|
||||||
|
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
||||||
|
|
||||||
|
@RoutePage()
|
||||||
|
class RemoteTimelinePage extends StatelessWidget {
|
||||||
|
final String albumId;
|
||||||
|
|
||||||
|
const RemoteTimelinePage({super.key, required this.albumId});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
timelineServiceProvider.overrideWith(
|
||||||
|
(ref) {
|
||||||
|
final timelineService = ref
|
||||||
|
.watch(timelineFactoryProvider)
|
||||||
|
.remoteAlbum(albumId: albumId);
|
||||||
|
ref.onDispose(() => unawaited(timelineService.dispose()));
|
||||||
|
return timelineService;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: const Timeline(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,12 @@
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
||||||
|
import 'package:immich_mobile/infrastructure/repositories/remote_album.repository.dart';
|
||||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||||
|
|
||||||
final localAlbumRepository = Provider<DriftLocalAlbumRepository>(
|
final localAlbumRepository = Provider<DriftLocalAlbumRepository>(
|
||||||
(ref) => DriftLocalAlbumRepository(ref.watch(driftProvider)),
|
(ref) => DriftLocalAlbumRepository(ref.watch(driftProvider)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final remoteAlbumRepository = Provider<DriftRemoteAlbumRepository>(
|
||||||
|
(ref) => DriftRemoteAlbumRepository(ref.watch(driftProvider)),
|
||||||
|
);
|
||||||
|
@ -34,6 +34,12 @@ class AuthRepository extends DatabaseRepository {
|
|||||||
db.users.clear(),
|
db.users.clear(),
|
||||||
_drift.remoteAssetEntity.deleteAll(),
|
_drift.remoteAssetEntity.deleteAll(),
|
||||||
_drift.remoteExifEntity.deleteAll(),
|
_drift.remoteExifEntity.deleteAll(),
|
||||||
|
_drift.userEntity.deleteAll(),
|
||||||
|
_drift.userMetadataEntity.deleteAll(),
|
||||||
|
_drift.partnerEntity.deleteAll(),
|
||||||
|
_drift.remoteAlbumEntity.deleteAll(),
|
||||||
|
_drift.remoteAlbumAssetEntity.deleteAll(),
|
||||||
|
_drift.remoteAlbumUserEntity.deleteAll(),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ import 'package:immich_mobile/presentation/pages/dev/feat_in_development.page.da
|
|||||||
import 'package:immich_mobile/presentation/pages/dev/local_timeline.page.dart';
|
import 'package:immich_mobile/presentation/pages/dev/local_timeline.page.dart';
|
||||||
import 'package:immich_mobile/presentation/pages/dev/main_timeline.page.dart';
|
import 'package:immich_mobile/presentation/pages/dev/main_timeline.page.dart';
|
||||||
import 'package:immich_mobile/presentation/pages/dev/media_stat.page.dart';
|
import 'package:immich_mobile/presentation/pages/dev/media_stat.page.dart';
|
||||||
|
import 'package:immich_mobile/presentation/pages/dev/remote_timeline.page.dart';
|
||||||
import 'package:immich_mobile/providers/api.provider.dart';
|
import 'package:immich_mobile/providers/api.provider.dart';
|
||||||
import 'package:immich_mobile/providers/gallery_permission.provider.dart';
|
import 'package:immich_mobile/providers/gallery_permission.provider.dart';
|
||||||
import 'package:immich_mobile/routing/auth_guard.dart';
|
import 'package:immich_mobile/routing/auth_guard.dart';
|
||||||
@ -365,6 +366,10 @@ class AppRouter extends RootStackRouter {
|
|||||||
page: MainTimelineRoute.page,
|
page: MainTimelineRoute.page,
|
||||||
guards: [_authGuard, _duplicateGuard],
|
guards: [_authGuard, _duplicateGuard],
|
||||||
),
|
),
|
||||||
|
AutoRoute(
|
||||||
|
page: RemoteTimelineRoute.page,
|
||||||
|
guards: [_authGuard, _duplicateGuard],
|
||||||
|
),
|
||||||
// required to handle all deeplinks in deep_link.service.dart
|
// required to handle all deeplinks in deep_link.service.dart
|
||||||
// auto_route_library#1722
|
// auto_route_library#1722
|
||||||
RedirectRoute(path: '*', redirectTo: '/'),
|
RedirectRoute(path: '*', redirectTo: '/'),
|
||||||
|
@ -1425,6 +1425,43 @@ class RemoteMediaSummaryRoute extends PageRouteInfo<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// generated route for
|
||||||
|
/// [RemoteTimelinePage]
|
||||||
|
class RemoteTimelineRoute extends PageRouteInfo<RemoteTimelineRouteArgs> {
|
||||||
|
RemoteTimelineRoute({
|
||||||
|
Key? key,
|
||||||
|
required String albumId,
|
||||||
|
List<PageRouteInfo>? children,
|
||||||
|
}) : super(
|
||||||
|
RemoteTimelineRoute.name,
|
||||||
|
args: RemoteTimelineRouteArgs(key: key, albumId: albumId),
|
||||||
|
initialChildren: children,
|
||||||
|
);
|
||||||
|
|
||||||
|
static const String name = 'RemoteTimelineRoute';
|
||||||
|
|
||||||
|
static PageInfo page = PageInfo(
|
||||||
|
name,
|
||||||
|
builder: (data) {
|
||||||
|
final args = data.argsAs<RemoteTimelineRouteArgs>();
|
||||||
|
return RemoteTimelinePage(key: args.key, albumId: args.albumId);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteTimelineRouteArgs {
|
||||||
|
const RemoteTimelineRouteArgs({this.key, required this.albumId});
|
||||||
|
|
||||||
|
final Key? key;
|
||||||
|
|
||||||
|
final String albumId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'RemoteTimelineRouteArgs{key: $key, albumId: $albumId}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [SearchPage]
|
/// [SearchPage]
|
||||||
class SearchRoute extends PageRouteInfo<SearchRouteArgs> {
|
class SearchRoute extends PageRouteInfo<SearchRouteArgs> {
|
||||||
|
1
mobile/openapi/README.md
generated
1
mobile/openapi/README.md
generated
@ -466,6 +466,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [SyncAckDto](doc//SyncAckDto.md)
|
- [SyncAckDto](doc//SyncAckDto.md)
|
||||||
- [SyncAckSetDto](doc//SyncAckSetDto.md)
|
- [SyncAckSetDto](doc//SyncAckSetDto.md)
|
||||||
- [SyncAlbumDeleteV1](doc//SyncAlbumDeleteV1.md)
|
- [SyncAlbumDeleteV1](doc//SyncAlbumDeleteV1.md)
|
||||||
|
- [SyncAlbumToAssetDeleteV1](doc//SyncAlbumToAssetDeleteV1.md)
|
||||||
- [SyncAlbumToAssetV1](doc//SyncAlbumToAssetV1.md)
|
- [SyncAlbumToAssetV1](doc//SyncAlbumToAssetV1.md)
|
||||||
- [SyncAlbumUserDeleteV1](doc//SyncAlbumUserDeleteV1.md)
|
- [SyncAlbumUserDeleteV1](doc//SyncAlbumUserDeleteV1.md)
|
||||||
- [SyncAlbumUserV1](doc//SyncAlbumUserV1.md)
|
- [SyncAlbumUserV1](doc//SyncAlbumUserV1.md)
|
||||||
|
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@ -249,6 +249,7 @@ part 'model/sync_ack_delete_dto.dart';
|
|||||||
part 'model/sync_ack_dto.dart';
|
part 'model/sync_ack_dto.dart';
|
||||||
part 'model/sync_ack_set_dto.dart';
|
part 'model/sync_ack_set_dto.dart';
|
||||||
part 'model/sync_album_delete_v1.dart';
|
part 'model/sync_album_delete_v1.dart';
|
||||||
|
part 'model/sync_album_to_asset_delete_v1.dart';
|
||||||
part 'model/sync_album_to_asset_v1.dart';
|
part 'model/sync_album_to_asset_v1.dart';
|
||||||
part 'model/sync_album_user_delete_v1.dart';
|
part 'model/sync_album_user_delete_v1.dart';
|
||||||
part 'model/sync_album_user_v1.dart';
|
part 'model/sync_album_user_v1.dart';
|
||||||
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@ -554,6 +554,8 @@ class ApiClient {
|
|||||||
return SyncAckSetDto.fromJson(value);
|
return SyncAckSetDto.fromJson(value);
|
||||||
case 'SyncAlbumDeleteV1':
|
case 'SyncAlbumDeleteV1':
|
||||||
return SyncAlbumDeleteV1.fromJson(value);
|
return SyncAlbumDeleteV1.fromJson(value);
|
||||||
|
case 'SyncAlbumToAssetDeleteV1':
|
||||||
|
return SyncAlbumToAssetDeleteV1.fromJson(value);
|
||||||
case 'SyncAlbumToAssetV1':
|
case 'SyncAlbumToAssetV1':
|
||||||
return SyncAlbumToAssetV1.fromJson(value);
|
return SyncAlbumToAssetV1.fromJson(value);
|
||||||
case 'SyncAlbumUserDeleteV1':
|
case 'SyncAlbumUserDeleteV1':
|
||||||
|
107
mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart
generated
Normal file
107
mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart
generated
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
//
|
||||||
|
// 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 SyncAlbumToAssetDeleteV1 {
|
||||||
|
/// Returns a new [SyncAlbumToAssetDeleteV1] instance.
|
||||||
|
SyncAlbumToAssetDeleteV1({
|
||||||
|
required this.albumId,
|
||||||
|
required this.assetId,
|
||||||
|
});
|
||||||
|
|
||||||
|
String albumId;
|
||||||
|
|
||||||
|
String assetId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is SyncAlbumToAssetDeleteV1 &&
|
||||||
|
other.albumId == albumId &&
|
||||||
|
other.assetId == assetId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(albumId.hashCode) +
|
||||||
|
(assetId.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'SyncAlbumToAssetDeleteV1[albumId=$albumId, assetId=$assetId]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'albumId'] = this.albumId;
|
||||||
|
json[r'assetId'] = this.assetId;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [SyncAlbumToAssetDeleteV1] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static SyncAlbumToAssetDeleteV1? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "SyncAlbumToAssetDeleteV1");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return SyncAlbumToAssetDeleteV1(
|
||||||
|
albumId: mapValueOfType<String>(json, r'albumId')!,
|
||||||
|
assetId: mapValueOfType<String>(json, r'assetId')!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<SyncAlbumToAssetDeleteV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <SyncAlbumToAssetDeleteV1>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = SyncAlbumToAssetDeleteV1.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, SyncAlbumToAssetDeleteV1> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, SyncAlbumToAssetDeleteV1>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = SyncAlbumToAssetDeleteV1.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of SyncAlbumToAssetDeleteV1-objects as value to a dart map
|
||||||
|
static Map<String, List<SyncAlbumToAssetDeleteV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<SyncAlbumToAssetDeleteV1>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = SyncAlbumToAssetDeleteV1.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'albumId',
|
||||||
|
'assetId',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -59,16 +59,28 @@ void main() {
|
|||||||
.thenAnswer(successHandler);
|
.thenAnswer(successHandler);
|
||||||
when(() => mockSyncStreamRepo.updateAssetsV1(any()))
|
when(() => mockSyncStreamRepo.updateAssetsV1(any()))
|
||||||
.thenAnswer(successHandler);
|
.thenAnswer(successHandler);
|
||||||
|
when(
|
||||||
|
() => mockSyncStreamRepo.updateAssetsV1(
|
||||||
|
any(),
|
||||||
|
debugLabel: any(named: 'debugLabel'),
|
||||||
|
),
|
||||||
|
).thenAnswer(successHandler);
|
||||||
when(() => mockSyncStreamRepo.deleteAssetsV1(any()))
|
when(() => mockSyncStreamRepo.deleteAssetsV1(any()))
|
||||||
.thenAnswer(successHandler);
|
.thenAnswer(successHandler);
|
||||||
|
when(
|
||||||
|
() => mockSyncStreamRepo.deleteAssetsV1(
|
||||||
|
any(),
|
||||||
|
debugLabel: any(named: 'debugLabel'),
|
||||||
|
),
|
||||||
|
).thenAnswer(successHandler);
|
||||||
when(() => mockSyncStreamRepo.updateAssetsExifV1(any()))
|
when(() => mockSyncStreamRepo.updateAssetsExifV1(any()))
|
||||||
.thenAnswer(successHandler);
|
.thenAnswer(successHandler);
|
||||||
when(() => mockSyncStreamRepo.updatePartnerAssetsV1(any()))
|
when(
|
||||||
.thenAnswer(successHandler);
|
() => mockSyncStreamRepo.updateAssetsExifV1(
|
||||||
when(() => mockSyncStreamRepo.deletePartnerAssetsV1(any()))
|
any(),
|
||||||
.thenAnswer(successHandler);
|
debugLabel: any(named: 'debugLabel'),
|
||||||
when(() => mockSyncStreamRepo.updatePartnerAssetsExifV1(any()))
|
),
|
||||||
.thenAnswer(successHandler);
|
).thenAnswer(successHandler);
|
||||||
|
|
||||||
sut = SyncStreamService(
|
sut = SyncStreamService(
|
||||||
syncApiRepository: mockSyncApiRepo,
|
syncApiRepository: mockSyncApiRepo,
|
||||||
|
2
mobile/test/fixtures/album.stub.dart
vendored
2
mobile/test/fixtures/album.stub.dart
vendored
@ -1,4 +1,4 @@
|
|||||||
import 'package:immich_mobile/domain/models/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
import 'package:immich_mobile/entities/album.entity.dart';
|
import 'package:immich_mobile/entities/album.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:immich_mobile/domain/models/local_album.model.dart';
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:immich_mobile/domain/models/album/local_album.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/local_album.model.dart';
|
|
||||||
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
||||||
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
|
||||||
|
|
||||||
|
@ -13450,6 +13450,21 @@
|
|||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"SyncAlbumToAssetDeleteV1": {
|
||||||
|
"properties": {
|
||||||
|
"albumId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"assetId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"albumId",
|
||||||
|
"assetId"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"SyncAlbumToAssetV1": {
|
"SyncAlbumToAssetV1": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"albumId": {
|
"albumId": {
|
||||||
|
@ -198,6 +198,7 @@ const responseDtos = [
|
|||||||
SyncAlbumUserV1,
|
SyncAlbumUserV1,
|
||||||
SyncAlbumUserDeleteV1,
|
SyncAlbumUserDeleteV1,
|
||||||
SyncAlbumToAssetV1,
|
SyncAlbumToAssetV1,
|
||||||
|
SyncAlbumToAssetDeleteV1,
|
||||||
SyncAckV1,
|
SyncAckV1,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user