You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-07 23:03:36 +02:00
feat(mobile): drift local albums page (#19817)
* feat(mobile): drift local albums page * fix: lint * refactor: use AsyncValue * fix: lint * local album thumbnail --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@ -361,6 +361,24 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||
batch.deleteWhere(_db.localAssetEntity, (f) => f.id.isIn(ids));
|
||||
});
|
||||
}
|
||||
|
||||
Future<LocalAsset?> getThumbnail(String albumId) async {
|
||||
final query = _db.localAlbumAssetEntity.select().join([
|
||||
innerJoin(
|
||||
_db.localAssetEntity,
|
||||
_db.localAlbumAssetEntity.assetId.equalsExp(_db.localAssetEntity.id),
|
||||
),
|
||||
])
|
||||
..where(_db.localAlbumAssetEntity.albumId.equals(albumId))
|
||||
..orderBy([OrderingTerm.asc(_db.localAssetEntity.id)])
|
||||
..limit(1);
|
||||
|
||||
final results = await query
|
||||
.map((row) => row.readTable(_db.localAssetEntity).toDto())
|
||||
.get();
|
||||
|
||||
return results.isNotEmpty ? results.first : null;
|
||||
}
|
||||
}
|
||||
|
||||
extension on LocalAlbumEntityData {
|
||||
|
Reference in New Issue
Block a user