1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/******************************************************************************************
📍 منصة تحليل الأمان الجغرافي MKT KSA – تطوير منصور بن خالد
* 📄 رخصة Apache 2.0 – يسمح بالاستخدام والتعديل بشرط النسبة وعدم تقديم ضمانات.
* MKT KSA Geolocation Security – Developed by Mansour Bin Khalid (KSA 🇸🇦)
* Licensed under Apache 2.0 – https://www.apache.org/licenses/LICENSE-2.0
* © 2025 All rights reserved.
اسم الملف: dashboard.rs
المسار: src/api/dashboard.rs
وظيفة الملف:
هذا الملف مسؤول عن جميع العمليات المتعلقة بعرض ملخصات لوحة التحكم عبر واجهة برمجة التطبيقات (API).
يوفر نقطة نهاية (Endpoint) لعرض ملخص إحصائي عن النظام (عدد المستخدمين، الأجهزة، التنبيهات، وآخر نوع تنبيه).
يتحقق من صلاحية المستخدم عبر JWT قبل عرض البيانات، ويعيد النتائج بشكل JSON موحد.
الملف مصمم ليكون نقطة مركزية لأي نظام خارجي أو لوحة تحكم ترغب في عرض إحصائيات النظام بشكل آمن وموثوق.
يمكن ربطه مستقبلاً بقاعدة البيانات لجلب الإحصائيات الحقيقية بدلاً من القيم الثابتة.
File name: dashboard.rs
Path: src/api/dashboard.rs
File purpose:
This file is responsible for all operations related to displaying dashboard summaries via the API.
It provides an endpoint to show a statistical summary of the system (user count, device count, alert count, and last alert type).
It verifies user authorization via JWT before displaying the data, and returns the results as a unified JSON response.
The file is designed as a central point for any external system or dashboard wishing to display system statistics securely and reliably.
It can be integrated with the database in the future to fetch real statistics instead of static values.
******************************************************************************************/
use crateBearerToken;
use crateJwtManager;
use ;
use Serialize;
/// نموذج الاستجابة لملخص لوحة التحكم.
/// Response model for dashboard summary.
/// نقطة نهاية لعرض ملخص لوحة التحكم عبر GET /dashboard/summary
/// Endpoint to show dashboard summary via GET /dashboard/summary
pub async