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

28 lines
740 B
Dart
Raw Normal View History

2022-01-25 11:08:13 +01:00
import 'package:logging/logging.dart';
import 'package:nc_photos/account.dart';
import 'package:nc_photos/db/entity_converter.dart';
2022-01-25 11:08:13 +01:00
import 'package:nc_photos/di_container.dart';
2022-12-16 16:01:04 +01:00
import 'package:np_codegen/np_codegen.dart';
import 'package:np_db/np_db.dart';
2022-01-25 11:08:13 +01:00
2022-12-16 16:01:04 +01:00
part 'cache_favorite.g.dart';
@npLog
2022-01-25 11:08:13 +01:00
class CacheFavorite {
const CacheFavorite(this._c);
2022-01-25 11:08:13 +01:00
/// Cache favorites using results from remote
///
/// Return the fileIds of the affected files
Future<DbSyncIdResult> call(
Account account, Iterable<int> remoteFileIds) async {
_log.info("[call] Cache favorites");
2024-01-30 18:11:21 +01:00
return _c.npDb.syncFavoriteFiles(
account: account.toDb(),
favoriteFileIds: remoteFileIds.toList(),
);
2022-01-25 11:08:13 +01:00
}
final DiContainer _c;
}