Skip to main content
#P1660

GET /v2/core/changelogs

Core System Changelogs

این اندپوینت وظیفه ارائه نسخه‌بندی کامل تغییرات سیستم (Change Log) را بر اساس ساختار SemVer توسعه‌یافته (major.minor.patch) بر عهده دارد. داده‌ها از جدول change_logs دریافت می‌شوند، سپس در قالب گروه‌بندی‌شده بر اساس نسخه، بازگردانده می‌شوند.

Request Overview

URL: /v2/core/changelogs
Method: GET
Controller: CoreController@changeLogs
Middleware Stack: authWithJwt → core

Access Control

  • توکن JWT معتبر
  • دسترسی فقط برای branch = "[0]" (براساس middleware core)

Database Query Logic

دریافت تمامی لاگ‌ها از جدول change_logs با مرتب‌سازی دقیق نسخه:

  • orderBy major DESC
  • orderBy minor DESC
  • orderBy patches DESC
  • orderBy created_at ASC (برای نمایش ترتیب وقوع تغییرات در هر نسخه)
DB::table('change_logs')
    ->orderBy('major', 'DESC')
    ->orderBy('minor', 'DESC')
    ->orderBy('patches', 'DESC')
    ->orderBy('created_at')
    ->get();
  

Version Grouping Logic

هر رکورد داخل گروه مخصوص نسخه قرار می‌گیرد. کلید گروه نسخه برابر است با: major . minor . patches بدون نقطه (مثلاً 231 → نسخه 02.03.01).

نسخه نهایی با صفرهای سمت چپ فرمت می‌شود:

  • major → دو رقمی
  • minor → دو رقمی
  • patch → دو رقمی
$changeLogs[$major.$minor.$patch]['version']
    = sprintf("%02d", major)
    . '.' . sprintf("%02d", minor)
    . '.' . sprintf("%02d", patch);
  

ساختار داده هر آیتم

[
  "title"       => row.title,
  "content"     => row.content,
  "created_at"  => CalendarUtils::strftime('Y/m/d', strtotime(row.created_at)),
  "tag"         => row.tag
]
  

Response (Success)

{
  "status": true,
  "time": 1710000000,
  "data": {
    "020301": {
      "version": "02.03.01",
      "data": [
        {
          "title": "Fix Accounting Issues",
          "content": "Detail text ...",
          "created_at": "1403/07/12",
          "tag": "fix"
        },
        ...
      ]
    },
    ...
  }
}
  

Response (Error)

در این متد try/catch وجود ندارد؛ هر خطای دیتابیس یا رانتایم به‌صورت Exception خام از طرف لاراول برگشته می‌شود (HTTP 500).

Flowchart

Validate JWT + Core Access
Query change_logs (ordered)
Group by Version (major/minor/patch)
Format Version & Date
Return Structured JSON