mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
* feat(mobile): stack sync * fix: lint * Update mobile/lib/infrastructure/repositories/sync_api.repository.dart Co-authored-by: Alex <alex.tran1502@gmail.com> --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
31 lines
822 B
Dart
31 lines
822 B
Dart
import 'package:drift/drift.dart';
|
|
import 'package:immich_mobile/domain/models/stack.model.dart';
|
|
import 'package:immich_mobile/infrastructure/entities/stack.entity.drift.dart';
|
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
|
|
|
class DriftStackRepository extends DriftDatabaseRepository {
|
|
final Drift _db;
|
|
const DriftStackRepository(this._db) : super(_db);
|
|
|
|
Future<List<Stack>> getAll(String userId) {
|
|
final query = _db.stackEntity.select()
|
|
..where((e) => e.ownerId.equals(userId));
|
|
|
|
return query.map((stack) {
|
|
return stack.toDto();
|
|
}).get();
|
|
}
|
|
}
|
|
|
|
extension on StackEntityData {
|
|
Stack toDto() {
|
|
return Stack(
|
|
id: id,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
ownerId: ownerId,
|
|
primaryAssetId: primaryAssetId,
|
|
);
|
|
}
|
|
}
|