nc-photos/app/lib/use_case/update_album.dart

19 lines
538 B
Dart
Raw Normal View History

2021-04-10 06:28:12 +02:00
import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/album.dart';
import 'package:nc_photos/exception.dart';
2021-04-10 06:28:12 +02:00
class UpdateAlbum {
const UpdateAlbum(this.albumRepo);
2021-04-10 06:28:12 +02:00
Future<void> call(Account account, Album album) async {
if (album.savedVersion > Album.version) {
// the album is created by a newer version of this app
throw AlbumDowngradeException(
"Not allowed to downgrade album '${album.name}'");
}
await albumRepo.update(account, album);
}
2021-04-10 06:28:12 +02:00
final AlbumRepo albumRepo;
}