refactor: user entity (#16655)
* refactor: user entity * fix: add users to album & user profile url * chore: rebase fixes * generate files * fix(mobile): timeline not reset on login * fix: test stub * refactor: rename user model (#16813) * refactor: rename user model * simplify import --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com> * chore: generate files * fix: use getAllAccessible instead of getAll --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/entities/user.entity.dart';
|
||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||
import 'package:immich_mobile/infrastructure/entities/user.entity.dart'
|
||||
as entity;
|
||||
import 'package:immich_mobile/interfaces/partner.interface.dart';
|
||||
import 'package:immich_mobile/providers/db.provider.dart';
|
||||
import 'package:immich_mobile/repositories/database.repository.dart';
|
||||
@@ -14,34 +16,40 @@ class PartnerRepository extends DatabaseRepository
|
||||
PartnerRepository(super.db);
|
||||
|
||||
@override
|
||||
Future<List<User>> getSharedBy() {
|
||||
return db.users
|
||||
.filter()
|
||||
.isPartnerSharedByEqualTo(true)
|
||||
.sortById()
|
||||
.findAll();
|
||||
Future<List<UserDto>> getSharedBy() async {
|
||||
return (await db.users
|
||||
.filter()
|
||||
.isPartnerSharedByEqualTo(true)
|
||||
.sortById()
|
||||
.findAll())
|
||||
.map((u) => u.toDto())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<User>> getSharedWith() {
|
||||
return db.users
|
||||
.filter()
|
||||
.isPartnerSharedWithEqualTo(true)
|
||||
.sortById()
|
||||
.findAll();
|
||||
Future<List<UserDto>> getSharedWith() async {
|
||||
return (await db.users
|
||||
.filter()
|
||||
.isPartnerSharedWithEqualTo(true)
|
||||
.sortById()
|
||||
.findAll())
|
||||
.map((u) => u.toDto())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<User>> watchSharedBy() {
|
||||
return db.users.filter().isPartnerSharedByEqualTo(true).sortById().watch();
|
||||
Stream<List<UserDto>> watchSharedBy() {
|
||||
return (db.users.filter().isPartnerSharedByEqualTo(true).sortById().watch())
|
||||
.map((users) => users.map((u) => u.toDto()).toList());
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<User>> watchSharedWith() {
|
||||
return db.users
|
||||
.filter()
|
||||
.isPartnerSharedWithEqualTo(true)
|
||||
.sortById()
|
||||
.watch();
|
||||
Stream<List<UserDto>> watchSharedWith() {
|
||||
return (db.users
|
||||
.filter()
|
||||
.isPartnerSharedWithEqualTo(true)
|
||||
.sortById()
|
||||
.watch())
|
||||
.map((users) => users.map((u) => u.toDto()).toList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user