mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 16:01:58 +00:00
44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
import 'package:isar_community/isar.dart';
|
|
import 'package:mangayomi/main.dart';
|
|
import 'package:mangayomi/models/chapter.dart';
|
|
import 'package:mangayomi/models/update.dart';
|
|
import 'package:mangayomi/models/history.dart';
|
|
import 'package:mangayomi/models/manga.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
part 'isar_providers.g.dart';
|
|
|
|
@riverpod
|
|
Stream<List<History>> getAllHistoryStream(
|
|
Ref ref, {
|
|
required ItemType itemType,
|
|
String search = "",
|
|
}) async* {
|
|
yield* isar.historys
|
|
.filter()
|
|
.idIsNotNull()
|
|
.and()
|
|
.chapter((q) => q.manga((q) => q.itemTypeEqualTo(itemType)))
|
|
.and()
|
|
.chapter(
|
|
(q) => q.manga((q) => q.nameContains(search, caseSensitive: false)),
|
|
)
|
|
.watch(fireImmediately: true);
|
|
}
|
|
|
|
@riverpod
|
|
Stream<List<Update>> getAllUpdateStream(
|
|
Ref ref, {
|
|
required ItemType itemType,
|
|
String search = "",
|
|
}) async* {
|
|
yield* isar.updates
|
|
.filter()
|
|
.idIsNotNull()
|
|
.and()
|
|
.chapter((q) => q.manga((q) => q.itemTypeEqualTo(itemType)))
|
|
.and()
|
|
.chapter(
|
|
(q) => q.manga((q) => q.nameContains(search, caseSensitive: false)),
|
|
)
|
|
.watch(fireImmediately: true);
|
|
}
|