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
86
87
88
89
90
91
92
/******************************************************************************************
📍 منصة تحليل الأمان الجغرافي 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.
اسم الملف: weather.rs
المسار: src/api/weather.rs
وظيفة الملف:
هذا الملف مسؤول عن جميع العمليات المتعلقة بجلب ملخصات الطقس عبر واجهة برمجة التطبيقات (API).
يوفر نقطة نهاية (Endpoint) لجلب بيانات الطقس بناءً على إحداثيات الموقع (خط العرض والطول)،
ثم يمررها إلى محرك الطقس في طبقة core (weather_val)، ويعيد النتيجة النهائية بشكل JSON.
يتحقق من صلاحية المستخدم عبر JWT قبل جلب البيانات، ويضمن أن كل عملية استعلام تتم بشكل آمن وموثوق.
الملف مصمم ليكون نقطة مركزية لأي نظام خارجي أو واجهة مستخدم ترغب في عرض أو تحليل بيانات الطقس.
يمكن ربطه مستقبلاً بمحرك طقس حقيقي أو خدمة خارجية.
File name: weather.rs
Path: src/api/weather.rs
File purpose:
This file is responsible for all operations related to fetching weather summaries via the API.
It provides an endpoint to fetch weather data based on location coordinates (latitude and longitude),
then passes them to the weather engine in the core layer (weather_val), and returns the final result as JSON.
It verifies user authorization via JWT before fetching the data, ensuring every query operation is secure and reliable.
The file is designed as a central point for any external system or user interface wishing to display or analyze weather data.
It can be integrated with a real weather engine or external service in the future.
******************************************************************************************/
use crateBearerToken;
use crateWeatherData;
use crateJwtManager;
use ;
use Deserialize;
/// نموذج الطلب لجلب بيانات الطقس.
/// Request model for weather summary.
/// نقطة نهاية لجلب ملخص الطقس عبر POST /weather/summary
/// Endpoint to get weather summary via POST /weather/summary
pub async