Use owner instead of shared flag when fetching albums.

This commit is contained in:
Tom graham
2025-01-08 15:42:37 +11:00
parent e35465ccf3
commit a42911b290
4 changed files with 34 additions and 8 deletions
@@ -34,11 +34,16 @@ class AlbumRepository extends DatabaseRepository implements IAlbumRepository {
Future<Album> create(Album album) => txn(() => db.albums.store(album));
@override
Future<Album?> getByName(String name, {bool? shared, bool? remote}) {
Future<Album?> getByName(String name, {bool? shared, bool? remote, bool? owner}) {
var query = db.albums.filter().nameEqualTo(name);
if (shared != null) {
query = query.sharedEqualTo(shared);
}
if (owner == true) {
query = query.owner((q) => q.isarIdEqualTo(Store.get(StoreKey.currentUser).isarId));
} else if (owner == false) {
query = query.owner((q) => q.not().isarIdEqualTo(Store.get(StoreKey.currentUser).isarId));
}
if (remote == true) {
query = query.localIdIsNull();
} else if (remote == false) {