2022-01-25 11:08:13 +01:00
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
import 'package:nc_photos/account.dart';
|
2023-12-06 15:05:33 +01:00
|
|
|
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';
|
2024-01-17 18:17:53 +01:00
|
|
|
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 {
|
2023-12-06 15:05:33 +01:00
|
|
|
const CacheFavorite(this._c);
|
2022-01-25 11:08:13 +01:00
|
|
|
|
2022-07-27 21:00:42 +02:00
|
|
|
/// Cache favorites using results from remote
|
|
|
|
///
|
2024-01-17 18:17:53 +01:00
|
|
|
/// Return the fileIds of the affected files
|
|
|
|
Future<DbSyncIdResult> call(
|
|
|
|
Account account, Iterable<int> remoteFileIds) async {
|
2022-07-27 21:00:42 +02:00
|
|
|
_log.info("[call] Cache favorites");
|
2024-01-30 18:11:21 +01:00
|
|
|
return _c.npDb.syncFavoriteFiles(
|
2023-12-06 15:05:33 +01:00
|
|
|
account: account.toDb(),
|
|
|
|
favoriteFileIds: remoteFileIds.toList(),
|
|
|
|
);
|
2022-01-25 11:08:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
final DiContainer _c;
|
|
|
|
}
|