feat: enhance profile screen with tab navigation and admin panels
- Added tab navigation for profile, database, users, suggestions, and AI sections. - Implemented database management with inventory, pantry, and products tabs. - Created Admin AI panel to display AI model information. - Introduced Admin Pending Products panel for managing product approvals. - Developed Admin Users panel for user management, including role changes and password resets. - Added data models for AI models and pending products.
This commit is contained in:
@@ -3,6 +3,8 @@ import '../../../core/api/api_client.dart';
|
||||
import '../../../core/api/api_paths.dart';
|
||||
import '../../../core/api/guarded_api_call.dart';
|
||||
import '../../auth/data/auth_providers.dart';
|
||||
import '../domain/ai_model_info.dart';
|
||||
import '../domain/pending_product.dart';
|
||||
import '../domain/user_admin.dart';
|
||||
|
||||
final adminRepositoryProvider = Provider<AdminRepository>((ref) {
|
||||
@@ -80,4 +82,37 @@ class AdminRepository {
|
||||
);
|
||||
return (result as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Future<List<PendingProduct>> listPendingProducts() async {
|
||||
final token = await _token();
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.getJson(ProductApiPaths.pending, token: token),
|
||||
);
|
||||
return (data as List<dynamic>)
|
||||
.map((e) => PendingProduct.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
Future<void> setProductStatus(int productId, String status) async {
|
||||
final token = await _token();
|
||||
await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.patchJson(
|
||||
ProductApiPaths.setStatus(productId),
|
||||
body: {'status': status},
|
||||
token: token,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<AiModelInfo>> listAiModels() async {
|
||||
final data = await guardedApiCall(
|
||||
_ref,
|
||||
() => _apiClient.getJson(AiApiPaths.models),
|
||||
);
|
||||
return (data as List<dynamic>)
|
||||
.map((e) => AiModelInfo.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user