b239ae3e5f
Replaces Firebase with a self-hosted PHP/MySQL API served from winded.prymsolutions.com. Includes full backend (schema, auth, events, teams, brackets, suggestions, stats, media, file upload) and updated Flutter repositories and domain models. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import '../../suggestions/domain/suggestion.dart';
|
|
import '../../suggestions/infrastructure/suggestions_repository.dart';
|
|
|
|
part 'admin_suggestions_notifier.g.dart';
|
|
|
|
/// Live Firestore-backed stream of every suggestion, newest first, for the
|
|
/// admin review dashboard.
|
|
@riverpod
|
|
Stream<List<Suggestion>> adminSuggestionsStream(
|
|
AdminSuggestionsStreamRef ref,
|
|
) {
|
|
final repo = ref.watch(suggestionsRepositoryProvider);
|
|
return repo.watchAllSuggestions();
|
|
}
|
|
|
|
/// Imperative wrapper around the suggestion write methods.
|
|
@riverpod
|
|
class AdminSuggestionsNotifier extends _$AdminSuggestionsNotifier {
|
|
@override
|
|
Future<void> build() async {}
|
|
|
|
Future<void> updateStatus(String id, SuggestionStatus status) async {
|
|
final repo = ref.read(suggestionsRepositoryProvider);
|
|
state = const AsyncLoading();
|
|
state = await AsyncValue.guard(() => repo.updateStatus(id, status));
|
|
}
|
|
|
|
Future<void> delete(String id) async {
|
|
final repo = ref.read(suggestionsRepositoryProvider);
|
|
state = const AsyncLoading();
|
|
state = await AsyncValue.guard(() => repo.deleteSuggestion(id));
|
|
}
|
|
}
|