fix(users): align user management API response parsing and field mapping
@Rithish-2914 ci sta già lavorando.
Dal 18/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What happened?
Problem
The Admin User Management page (/users) is unable to render users and perform moderation actions due to API contract mismatches:
-
Empty Users Table:
getUsers()insrc/api/users.tsexpects an un-enveloped response{ status: string, users: User[], next_cursor?: string }.- The backend
GET /admin/usersreturns standard envelope{ "message": "Users fetched successfully", "data": [ UserResponse... ] }. - Because
response.data.usersisundefined, the TanStack table receives an empty array and displays no users.
-
Field Mapping & Ban/Unban Parsing:
- Backend
UserResponsereturns snake_case fields (id,name,email,reg_no,role,round_qualified,is_banned,balance,score), which need consistent normalization into the frontendUsermodel. banUserandunbanUserneed response handling aligned with{ message: string, data: UserResponse }.
- Backend
-
User Upgrade Request Body:
upgradeUserToRound()currently sends an empty POST body toPOST /admin/users/:id/upgrade, whereas the backend expectsUpgradeUserRequestcontaininground_qualified/role.
Proposed Solution
-
Update
src/api/users.ts:- Unwrap
response.data.dataingetUsers()and normalizeid,name,email,reg_no,role,round_qualified, andis_banned. - Update
banUser()andunbanUser()to handle backend response envelopes. - Allow passing
roundQualifiedandroleinupgradeUserToRound().
- Unwrap
-
Update
src/app/(protected)/users/page.tsx&user-columns.tsx:- Ensure table accessors read the normalized
Userdata. - Fix pagination display text.
- Ensure table accessors read the normalized
Affected Files
src/api/users.tssrc/app/(protected)/users/page.tsxsrc/app/(protected)/users/user-columns.tsx
Steps to reproduce
Steps to Reproduce
- Start the Go backend and log into the Admin portal (
cookoff-admin-11.0) with an admin account. - Navigate to the Users tab from the sidebar (
/users). - Observed Behavior: The table remains completely empty with no user rows rendered, despite users existing in the database (since
response.data.usersisundefined). - Inspect Network tab for
GET /admin/users: the response returns{ "message": "Users fetched successfully", "data": [...] }with snake_case keys (id,reg_no,round_qualified), but the frontend expects{ users: [...] }and PascalCase keys (ID,RegNo,RoundQualified). - Triggering Ban/Unban or user upgrade fails to handle response wrappers or sends empty upgrade payloads.
Expected Behavior
/usersshould unwrapresponse.data.data, populate the table with all registered users, correctly display details (Name, RegNo, Email, Round, Role), and allow instant banning/unbanning and round upgrades
Environment
No response
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeChefVIT/cookoff-admin-11.0
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
fix(submissions): consume flat UserSubmissionResponse[] instead of nested .submission/.resultsApertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
fix(users): add target round and role payload to user upgrade endpointForse di nuovo libera @Rithish-2914 l’ha presa 54 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
CodeChefVIT/cookoff-admin-11.0#22 · 1 assegnatario ·
-
fix(leaderboard): align leaderboard API response parsing and podium rankingsForse di nuovo libera @Rithish-2914 l’ha presa 54 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
CodeChefVIT/cookoff-admin-11.0#19 · 1 assegnatario ·
Tutte le issue di CodeChefVIT/cookoff-admin-11.0
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
lingdojo/kana-dojo#33947 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
paperclipai/paperclip#20942 ·
I maintainer di solito rispondono entro 1 giorno
-
area: documentation good first issue package: rule-data status: accepting prs
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
mastra-ai/mastra#30109 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno