From bc2e085c70cb389c3d87747e6208214518933b7a Mon Sep 17 00:00:00 2001 From: cryptocommuniums-afk Date: Mon, 16 Feb 2026 12:22:22 +0800 Subject: [PATCH] fix: rating-history API - pass auth token, fix table/column names - frontend: pass token to listRatingHistory API call - backend: fix SQL table name redeem_logs -> redeem_records - backend: fix SQL column name title -> task_code in daily_task_logs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- backend/src/services/solution_access_service.cc | 4 ++-- frontend/src/app/me/page.tsx | 2 +- frontend/src/lib/api.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/services/solution_access_service.cc b/backend/src/services/solution_access_service.cc index 85643a8..0405deb 100644 --- a/backend/src/services/solution_access_service.cc +++ b/backend/src/services/solution_access_service.cc @@ -247,13 +247,13 @@ SolutionAccessService::ListRatingHistory(int64_t user_id, int limit) { "' || problem_id) as note " "FROM problem_solution_view_logs WHERE user_id=? AND cost > 0 " "UNION ALL " - "SELECT 'daily_task' as type, created_at, reward as change, title as " + "SELECT 'daily_task' as type, created_at, reward as change, task_code as " "note " "FROM daily_task_logs WHERE user_id=? " "UNION ALL " "SELECT 'redeem' as type, created_at, -total_cost as change, item_name " "as note " - "FROM redeem_logs WHERE user_id=? " + "FROM redeem_records WHERE user_id=? " "ORDER BY created_at DESC LIMIT ?"; CheckSqlite(sqlite3_prepare_v2(db, sql, -1, &stmt, nullptr), db, diff --git a/frontend/src/app/me/page.tsx b/frontend/src/app/me/page.tsx index 95eb5f3..4c19772 100644 --- a/frontend/src/app/me/page.tsx +++ b/frontend/src/app/me/page.tsx @@ -149,7 +149,7 @@ export default function MePage() { apiFetch("/api/v1/me/redeem/items", {}, tk), apiFetch("/api/v1/me/redeem/records?limit=200", {}, tk), apiFetch("/api/v1/me/daily-tasks", {}, tk), - listRatingHistory(50), + listRatingHistory(50, tk), ]); setProfile(me); setItems(redeemItems ?? []); diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index be5db67..53f800f 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -98,6 +98,6 @@ export interface RatingHistoryItem { note: string; } -export async function listRatingHistory(limit: number = 100): Promise { - return apiFetch(`/api/v1/me/rating-history?limit=${limit}`); +export async function listRatingHistory(limit: number = 100, token?: string): Promise { + return apiFetch(`/api/v1/me/rating-history?limit=${limit}`, {}, token); }