mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
24 lines
778 B
Dart
24 lines
778 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);
|
|
}
|
|
}
|