Skip to content

Add LGA-scoped ward CSV export/import on the admin Ward Records page - #26

Merged
dprograma merged 3 commits into
mainfrom
claude/lga-auth-e2e-test-ocez8x
Jul 27, 2026
Merged

Add LGA-scoped ward CSV export/import on the admin Ward Records page#26
dprograma merged 3 commits into
mainfrom
claude/lga-auth-e2e-test-ocez8x

Conversation

@dprograma

Copy link
Copy Markdown
Owner

Summary

  • Selecting an LGA on the admin Ward Records tab could only export a CSV of all 774 LGAs' wards, not just the selected LGA's wards — making it impractical to bulk-correct one LGA's wards via CSV.
  • Adds a "select LGA" dropdown (scoped to the chosen state, since there are 774+ LGAs — too many for one flat dropdown) that filters both the ward table and the Export CSV button to that LGA alone. The Export button label updates to show which LGA is scoped (e.g. "Export CSV — Ikeja").
  • The existing bulk CSV import already upserts wards by lgaName + state per row, so re-uploading the scoped export via the existing "CSV Import" button already round-trips correctly — updating only that LGA's wards, no backend change needed there.
  • GET /api/admin/wards and GET /api/admin/wards/export both gained an lgaId filter alongside the existing state/id filters.

Test plan

  • npx tsc --noEmit — clean
  • npx eslint on all changed files — no new errors (one pre-existing warning unrelated to this change)
  • Manual API verification: exported CSV for a 3-ward test LGA contains exactly those 3 rows; editing and re-uploading it via POST /api/admin/wards updates all 3 records correctly
  • Manual browser verification (desktop + mobile 393×852 viewport): selecting a state then an LGA correctly scopes the table, the export filename, and the CSV contents to just that LGA; other LGAs' wards untouched
  • Added 2 new regression tests covering ?lgaId= on both the export and list endpoints, including that a second LGA's wards are excluded and untouched by the round-trip
  • Full suite: npx playwright test --project=api — 456 passed (454 existing + 2 new)

Generated by Claude Code

claude added 3 commits July 24, 2026 19:00
Analytics, Press Releases, Live Streams, Audit Reports, Procurement,
and Users were built with dark-theme classes (text-white, text-green-
200/*, bg-white/5, border-white/10) assuming a dark page background,
but the admin content area is actually light (bg-slate-50) — headings,
subtitles, stat labels, search placeholders, and pagination text were
all rendering nearly invisible (white/pale-green on white). Converted
all six to the light theme already used correctly elsewhere in the
admin panel (LGA Approvals, Wards, Payments, Allocations).

The Users list row had the same non-stacking layout bug fixed earlier
on LGA Approvals — avatar, name, badges, and Suspend/Ban buttons were
forced into one non-wrapping row, so on mobile names and emails
truncated to a single character ("K…", "ke…") and buttons crowded the
text. Now stacks properly on narrow screens.

Also found the root cause of a stray corrupted byte discovered while
editing press-releases: the previous session's arrow-mojibake fix
(sed replacing "â†" with "←") left a dangling C1 control byte (U+0090)
immediately after the arrow in 5 files, invisible in normal viewing
but preventing exact-string edits on those lines. Fixed at the byte
level and confirmed zero remaining control-character corruption
across the whole app/ tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPJE5cNDtQ4j7yeg9Xjtxw
…ypass

Nigeria has exactly 774 LGAs, but POST /api/lga/register had no limit on
how many rows could be created — the admin dashboard could accumulate
unlimited fake LGAs. Blocks the "fresh create" branch (no matching seeded
row) once the total hits 774; the "claim a seeded LGA" branch is untouched
so real chairmen can always register against the official 774 seeded via
/api/admin/seed. Test/seed scripts bypass the cap with the existing
SEED_SECRET via an x-seed-secret header.

Updates the Playwright suite's registration helpers to send the bypass
header (the local test DB already exceeds 774 from prior test runs), and
adds regression coverage for both the cap and the seeded-claim exemption.
Selecting an LGA on the Ward tab could only ever export a CSV of all
774 LGAs' wards, not just the selected one, making it impractical to
bulk-correct a single LGA's wards via CSV round-trip.

Adds an LGA picker (scoped to the chosen state, since there are 774+
LGAs) that filters both the ward table and the Export CSV button to
that LGA alone. The existing bulk CSV import already upserts by
lgaName+state per row, so re-uploading the scoped export already
updates just that LGA's wards.

Backend: GET /api/admin/wards and GET /api/admin/wards/export both
gained a `lgaId` filter alongside the existing `state`/`id` filters.
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
774ng Building Building Preview, Comment Jul 27, 2026 12:35pm

@dprograma
dprograma merged commit 9624f29 into main Jul 27, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants