mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: use sqlite timeline user provider (#19577)
use sqlite timeline user provider Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
30b4f334d8
commit
72a53f43c8
3 changed files with 33 additions and 4 deletions
|
|
@ -15,6 +15,21 @@ class DriftTimelineRepository extends DriftDatabaseRepository {
|
|||
|
||||
const DriftTimelineRepository(super._db) : _db = _db;
|
||||
|
||||
Stream<List<String>> watchTimelineUserIds(String userId) {
|
||||
final query = _db.partnerEntity.selectOnly()
|
||||
..addColumns([_db.partnerEntity.sharedById])
|
||||
..where(
|
||||
_db.partnerEntity.inTimeline.equals(true) &
|
||||
_db.partnerEntity.sharedWithId.equals(userId),
|
||||
);
|
||||
|
||||
return query
|
||||
.map((row) => row.read(_db.partnerEntity.sharedById)!)
|
||||
.watch()
|
||||
// Add current user ID to the list
|
||||
.map((users) => users..add(userId));
|
||||
}
|
||||
|
||||
List<Bucket> _generateBuckets(int count) {
|
||||
final numBuckets = (count / kTimelineNoneSegmentSize).floor();
|
||||
final buckets = List.generate(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue