Skip to content

Admin: CSV for every list, saved all or nothing - #330

Open
b4sleal wants to merge 6 commits into
feat/event-page-extrasfrom
feat/admin-csv-v2
Open

b4sleal wants to merge 6 commits into
feat/event-page-extrasfrom
feat/admin-csv-v2

Conversation

@b4sleal

@b4sleal b4sleal commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Events, team, guests and companies can all be exported and imported as CSV, using the v2 columns, and each import saves all of it or none of it. The old free-text events.location is no longer read anywhere, and tickets show the kind of event.

Closes #295
Closes #296
Closes #298
Part of #328

Type of change

  • 🎨 Frontend (public site UI, pages, styles, content)
  • ⚙️ Backend / admin (admin dashboard, Supabase tables, RLS policies, data fetching, config)
  • 📝 Docs / chore (README, CI, dependencies, cleanup)

What changed

  • Database functions (supabase/v2/18_csv_imports.sql): v2.import_events, import_team, import_guests and import_companies. Each saves the new rows, then the changed ones, in one transaction, so a refused row, a missing id or a bad value saves nothing. They run as the caller, so RLS still decides who can write, and only signed-in users can call them. Posters, photos and logos are never touched.
  • Events CSV: every field of the event form except the poster.
    • Category and highlights can be written as the code or the name ("Meet the Pros").
    • Times can be 7:30PM or 19:30. An end time before the start is an error.
    • Building codes must be ones the admin knows.
    • An empty slug gets one from the title and year on a new event, and keeps the saved one on a changed event.
  • Guests CSV (new): name, title, company by name, link. A company that isn't on Companies is an error that says to add it there first.
  • Companies CSV (new): name, colour, link.
  • Pages: /guests/import and /guests/companies/import, with Export and Import buttons on both lists. All four import pages share one page shell (CsvImportPage) for loading and errors.
  • Formats: each list's format is its own file in lib/csv/, and they all reuse the form schemas (the company sheet's schema moved to lib/form/company-form.ts).
  • location removed from the admin's event type, form and CSV, the site's place reading, and 03_populate.sql. 19_drop_event_location.sql drops the column; it stops if an in-person event still has only the old text.
  • Tickets show the kind of event as a dot in its accent with its name (Phase 2.1 [Frontend]: Event form fields, time ranges and category badges #298). The kind-to-colour mapping is one record in lib/ui/accents.ts.
  • Guide: the spreadsheet section covers guests, companies and the new event columns.

⚙️ Backend / admin only: data changes

  • No Supabase changes

  • Supabase schema changed (tables/columns listed below, with a migration or SQL included)

  • RLS policies added or changed (only signed-in execs can write; public can only read)

  • New environment variables (added to .env.example and noted below)

  • 18_csv_imports.sql (step 19): four import functions, security invoker, execute for authenticated only. Already applied on the live project, after a dry run where an insert, an id that doesn't exist and a bad category all rolled back cleanly.

  • 19_drop_event_location.sql (step 20): drops events.location. Not applied yet. Run it only after this PR is merged and deployed, because the admin and site before it still read the column. No event depends on location today (0 of 28).


How to test

  1. pnpm i && pnpm dev in apps/admin
  2. Events: press Export CSV, then import the file unchanged. It should say every row matches what's saved.
  3. Change a time and a category (write it as Meet the Pros), add a row with an empty id, then import. Check the print order, then press Import.
  4. Set a row's category to party and import. The order comes back "Sent back" and nothing is saved.
  5. Guests: export, change a title, add a guest with company google, then import. Try a company that doesn't exist and check the error.
  6. Companies (Guests → Companies): export, change a colour, add one, then import.
  7. On the Events list, each ticket shows its kind with a coloured dot.

Checklist

  • pnpm lint and pnpm build pass locally
  • PR is small and focused on one issue
  • I understand every line of this code (AI-assisted is fine, AI-authored without review is not)
  • No secrets, keys, or .env files committed (anon key only on the client, never the service role key)
  • Docs/README updated if setup, routes, or env vars changed

@b4sleal b4sleal self-assigned this Dec 2, 2026
@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
admin_page Ready Ready Preview Dec 2, 2026 12:51am UTC
better-website Ready Ready Preview Dec 2, 2026 12:51am UTC

This branch was successfully deployed

1 active deployment
Preview – better-website — 5e90620c Deployed Dec 2, 2026 by vercel[bot]
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.

1 participant