nc-photos/app/lib/use_case/cache_favorite.dart
2024-02-07 01:14:30 +08:00

27 lines
740 B
Dart

import 'package:logging/logging.dart';
import 'package:nc_photos/account.dart';
import 'package:nc_photos/db/entity_converter.dart';
import 'package:nc_photos/di_container.dart';
import 'package:np_codegen/np_codegen.dart';
import 'package:np_db/np_db.dart';
part 'cache_favorite.g.dart';
@npLog
class CacheFavorite {
const CacheFavorite(this._c);
/// 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");
return _c.npDb.syncFavoriteFiles(
account: account.toDb(),
favoriteFileIds: remoteFileIds.toList(),
);
}
final DiContainer _c;
}