feat(defects): read API — feed, per-section counts and history (T6)
GET /api/defects returns a newest-first feed joined to the project name,
bounded by limit; ?section=ID narrows to one section's history. GET
/api/defects/counts returns { sectionId: n } for the weak-point map. Adds a
(section_id, created_at) index and a db:seed script; ~2k rows query in ~20ms.
This commit is contained in:
7
server/api/defects/counts.get.ts
Normal file
7
server/api/defects/counts.get.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { getDb } from '../../db/client'
|
||||
import { countDefectsBySection } from '../../db/repositories/defects'
|
||||
|
||||
// Per-section defect counts `{ sectionId: n }` for the weak-point map (F4/F6).
|
||||
export default defineEventHandler(async () => {
|
||||
return countDefectsBySection(getDb())
|
||||
})
|
||||
Reference in New Issue
Block a user