نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق». نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا `cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules · .dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore. هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ. ⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
57 lines
1.6 KiB
Dart
57 lines
1.6 KiB
Dart
import 'dart:convert';
|
|
import 'package:get/get.dart';
|
|
import 'package:siro_admin/constant/links.dart';
|
|
import 'package:siro_admin/controller/functions/crud.dart';
|
|
import 'package:siro_admin/views/widgets/snackbar.dart';
|
|
import '../../print.dart';
|
|
|
|
class SecurityV2Controller extends GetxController {
|
|
bool isLoading = true;
|
|
List<dynamic> auditLogs = [];
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
fetchAuditLogs();
|
|
}
|
|
|
|
Future<void> fetchAuditLogs() async {
|
|
isLoading = true;
|
|
update();
|
|
|
|
try {
|
|
Log.print('Fetching from: ${AppLink.auditLogsV2}');
|
|
var res = await CRUD().get(link: AppLink.auditLogsV2, payload: {});
|
|
Log.print('Raw audit res type: ${res.runtimeType} | value: $res');
|
|
|
|
if (res == 'failure' || res == 'token_expired') {
|
|
Log.print('CRUD returned: $res');
|
|
mySnackbarError("السيرفر أرجع: $res");
|
|
auditLogs = [];
|
|
} else if (res != null) {
|
|
var d = res is String ? jsonDecode(res) : res;
|
|
Log.print('Decoded audit response: $d');
|
|
if (d['status'] == 'success') {
|
|
var message = d['message'];
|
|
if (message is List) {
|
|
auditLogs = message;
|
|
Log.print('Loaded ${auditLogs.length} audit logs');
|
|
} else {
|
|
auditLogs = [];
|
|
Log.print('message is not List: ${message.runtimeType}');
|
|
}
|
|
} else {
|
|
Log.print('Status not success: ${d['status']}');
|
|
mySnackbarError("${d['message'] ?? d['status']}");
|
|
}
|
|
}
|
|
} catch (e) {
|
|
Log.print('Error fetching audit logs: $e');
|
|
mySnackbarError("$e");
|
|
}
|
|
|
|
isLoading = false;
|
|
update();
|
|
}
|
|
}
|