Skip to main content
#P1658

POST /v2/core/airports/list

Core Airports List

این اندپوینت برای دریافت لیست فرودگاه‌ها با فیلترهای پیشرفته، Pagination مشابه DataTables، و غنی‌سازی داده‌ها (Country از Redis/DB و City از DB) استفاده می‌شود. خروجی کاملاً استاندارد و سازگار با سیستم‌های مدیریت داده (DataTables‑Compatible Response) است.

Request Overview

URL: /v2/core/airports/list
Method: POST
Controller: CoreController@airportsList
Middleware Stack: authWithJwt → core

Access Control

  • JWT معتبر
  • middleware core فقط وقتی اجازه می‌دهد که:
    operator.branch == "[0]"

Request Body Schema

Field Type Required Description
json string (JSON) yes حاوی پارامترهای DataTables (start, length, draw, advanced filters)
lang.id string|integer optional شناسه زبان (در این متد استفاده عملی ندارد)

Structure Inside json

Field Type Description
start integer Offset اولیه
length integer اندازه هر صفحه
draw integer شاخص درخواست DataTables
advanced.country string فیلتر کشور
advanced.state string فیلتر استان
advanced.city string فیلتر شهر
advanced.iata string فیلتر IATA
advanced.type string فیلتر نوع فرودگاه
advanced.r string جستجوی آزاد روی title, title_fa, description, address

Pagination Logic

  • اگر start = 0 → start = length
  • در غیر این صورت → start = start + length
  • page = (start / length)
  • کوئری paginate با pageName = "airports"

Filtering Logic

تمام فیلترها داخل Closure:

  • country → where('country')
  • state → where('state')
  • city → where('city')
  • iata → where('iata')
  • type → where('type')
  • r → applied on:
    • title LIKE %r%
    • title_fa LIKE %r%
    • description LIKE %r%
    • address LIKE %r%
  • status = 1
  • ORDER BY id DESC

Country & City Enrichment

Country (Redis → DB Fallback)

  • Redis key: countries:{country_id}
  • اگر موجود نبود:
    • اطلاعات از DB خوانده می‌شود (جدول countries)
    • در Redis ذخیره می‌شود
  • در خروجی: فقط fa_name (در صورت نبود → id اصلی)

City Resolution

Lookup مستقیم DB:

  • جدول cities با join روی states
  • خروجی شامل:
    • city.title_fa → نمایش نام فارسی شهر
    • state.fa_name → نمایش استان
  • اگر City یافت نشد → فیلدهای state و city از DB اصلی airport (city/state ID) استفاده می‌شود.

Final Output Mapping

{
  "id": airport.id,
  "title": airport.title,
  "title_fa": airport.title_fa,
  "iata": airport.iata,
  "country": resolved_country,
  "state": resolved_state_name,
  "city": resolved_city_name,
  "location": airport.location,
  "description": airport.description,
  "logo": airport.logo,
  "image": airport.image,
  "status": airport.status
}
  

Response (Success)

{
  "status": true,
  "time": 1710000000,
  "draw": ,
  "recordsTotal": ,
  "recordsFiltered": ,
  "data": [...]
}
  

Response (Error)

{
  "status": false,
  "code": "1003",
  "message": "(Exception message)",
  "trace": [...]
}
  

Flowchart

Validate JWT & Core Access
Parse json → Data object
Compute Pagination (start / length)
Apply Filters (country/state/city/iata/type/r)
Query airports with paginate
Resolve Country (Redis → DB)
Resolve City + State from tables
Assemble Response Array
Return DataTables-Compatible JSON