Skip to content

BACKEND ISSUE 01 — Dashboard Analytics APIs #2

@LeDuyCoder

Description

@LeDuyCoder

🎯 Goal

Implement API thống kê tổng quan cho dashboard (Stat Cards).


📡 Endpoint

GET /dashboard/stats


🧾 RESPONSE CONTRACT

{
  "code": 200,
  "message": "Fetch dashboard statistics successfully",
  "data": {
    "totalArticles": { "value": 128450, "growthRate": 12.5 },
    "totalJournals": { "value": 3420, "growthRate": 4.2 },
    "totalAuthors": { "value": 89200, "growthRate": 8.1 },
    "totalCitations": { "value": 1450200, "growthRate": 18.3 }
  }
}

🧠 BUSINESS LOGIC

  • Aggregate totals for Articles, Journals, Authors, Citations
  • Calculate growthRate vs previous period

Formula:
growthRate = ((current - previous) / previous) * 100


⚠️ EDGE CASES

  • previous = 0 → return 0 or 100 (define rule)
  • null → fallback 0
  • negative growth allowed

🧪 ACCEPTANCE CRITERIA

  • API returns correct JSON structure
  • No null values in response
  • Stable format for FE consumption

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions