fix: chart surat BigInt serialization error
Root Cause: - PostgreSQL COUNT(*) returns BigInt (1n) - Elysia cannot serialize BigInt to JSON - Frontend receives error instead of data Solution: - Cast COUNT(*) to INTEGER in SQL query - Changed: COUNT(*) as count - To: COUNT(*)::INTEGER as count - Now returns regular number instead of BigInt Files changed: - src/api/complaint.ts: Fixed service-trends endpoint Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -123,7 +123,7 @@ export const complaint = new Elysia({
|
||||
SELECT
|
||||
TO_CHAR("createdAt", 'Mon') as month,
|
||||
EXTRACT(MONTH FROM "createdAt") as month_num,
|
||||
COUNT(*) as count
|
||||
COUNT(*)::INTEGER as count
|
||||
FROM service_letter
|
||||
WHERE "createdAt" > NOW() - INTERVAL '6 months'
|
||||
GROUP BY month, month_num
|
||||
|
||||
Reference in New Issue
Block a user