توثيق طبقة البيانات
الواجهة معزولة عن البيانات عبر وحدة واحدة، جاهزة للتبديل إلى خادم حقيقي.
كيف تعمل الطبقة
كل الواجهة تقرأ وتكتب عبر وحدة واحدة بواجهة تشبه REST. لتبديل البيانات التجريبية بخادم حقيقي (Node/Express أو Next.js مع PostgreSQL) استبدل جسم كل دالة بنداء شبكة — لا يتغير أي مكوّن في الواجهة.
الجداول المقترحة
| الجدول | الحقول |
|---|---|
| users | id, name, nationality, flag, area_id, governorate, years_in_kuwait, bio, verified_neighbor |
| areas | id, name, governorate, members, active_posts, description, image_url |
| posts | id, author_id, area_id, type, body, image_url, likes, shares, created_at |
| comments | id, post_id, author_id, body, created_at |
| groups | id, name, kind, flag, members, description, next_meetup |
| services | id, name, category, area_id, rating, phone, whatsapp, hours, recommended |
| events | id, title, area_id, host, starts_at, capacity, attending, category |
| jobs | id, title, company, area_id, type, salary_min, salary_max, posted_at |
| housing | id, title, area_id, rent, furnished, gender_preference, rooms |
| alerts | id, title, body, area_id, severity, category, created_at |
| notifications | id, user_id, kind, actor_id, text, read, created_at |
| messages | id, conversation_id, from_id, body, created_at |
نقاط النهاية
- GET /api/posts?area=&type=&sort=
- POST /api/posts
- POST /api/posts/:id/like
- POST /api/posts/:id/save
- GET /api/posts/:id/comments
- GET /api/areas
- GET /api/groups
- GET /api/services?category=&area=&q=
- GET /api/events
- POST /api/events/:id/attend
- GET /api/jobs
- GET /api/housing
- GET /api/alerts?area=
- GET /api/conversations
- POST /api/conversations/:id/messages
- GET /api/search?q=