2024-09-24 06:24:48 +00:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
import 'package:immich_mobile/entities/exif_info.entity.dart';
|
|
|
|
import 'package:immich_mobile/interfaces/exif_info.interface.dart';
|
|
|
|
import 'package:immich_mobile/providers/db.provider.dart';
|
2024-09-30 14:37:30 +00:00
|
|
|
import 'package:immich_mobile/repositories/database.repository.dart';
|
2024-09-24 06:24:48 +00:00
|
|
|
|
|
|
|
final exifInfoRepositoryProvider =
|
|
|
|
Provider((ref) => ExifInfoRepository(ref.watch(dbProvider)));
|
|
|
|
|
2024-09-30 14:37:30 +00:00
|
|
|
class ExifInfoRepository extends DatabaseRepository
|
|
|
|
implements IExifInfoRepository {
|
|
|
|
ExifInfoRepository(super.db);
|
2024-09-24 06:24:48 +00:00
|
|
|
|
|
|
|
@override
|
2024-09-30 14:37:30 +00:00
|
|
|
Future<void> delete(int id) => txn(() => db.exifInfos.delete(id));
|
2024-09-24 06:24:48 +00:00
|
|
|
|
|
|
|
@override
|
2024-09-30 14:37:30 +00:00
|
|
|
Future<ExifInfo?> get(int id) => db.exifInfos.get(id);
|
2024-09-24 06:24:48 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<ExifInfo> update(ExifInfo exifInfo) async {
|
2024-09-30 14:37:30 +00:00
|
|
|
await txn(() => db.exifInfos.put(exifInfo));
|
2024-09-24 06:24:48 +00:00
|
|
|
return exifInfo;
|
|
|
|
}
|
2024-09-30 14:37:30 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<List<ExifInfo>> updateAll(List<ExifInfo> exifInfos) async {
|
|
|
|
await txn(() => db.exifInfos.putAll(exifInfos));
|
|
|
|
return exifInfos;
|
|
|
|
}
|
2024-09-24 06:24:48 +00:00
|
|
|
}
|