Skip to content

Add country field and support more fields in person CSV import/export#1100

Merged
NicoPennec merged 2 commits into
cgwire:mainfrom
NicoPennec:user-country
Jun 2, 2026
Merged

Add country field and support more fields in person CSV import/export#1100
NicoPennec merged 2 commits into
cgwire:mainfrom
NicoPennec:user-country

Conversation

@NicoPennec
Copy link
Copy Markdown
Member

Problem

  • Person has no country, which the carbon-footprint plugin needs to estimate travel emissions.
  • CSV person import/export only covers name, email, phone, role and contract type, so studios cannot bulk-manage country, position, seniority, daily salary, studio and departments.
  • ISO 3166-1 country validation would otherwise be duplicated across the model, the API, the CSV import and the SAML SSO path.

Solution

  • Add a nullable ISO 3166-1 alpha-2 country column on Person, validated and uppercased, settable via POST/PUT and SAML SSO, and kept out of the minimal (non-manager) payload.
  • Import/export country, position, seniority, daily salary, studio and departments; typed columns accept either the human label or the stored code, studio/department names match exactly (case-sensitive), and invalid values fail the row with a 400.
  • Factor the validation into a single normalize_country helper shared by the model validator (silently discards), the API guard (400) and the CSV import (fails the row).
  • On SAML SSO, normalize the country to its canonical form so an unchanged value no longer re-triggers an update on every login; an empty value clears it while a malformed assertion is ignored rather than wiping a stored code or breaking sign-in.
  • Add a migration for the nullable country column.

Optional nullable ISO 3166-1 alpha-2 `country` (carbon footprint plugin):
validated/uppercased, set via POST/PUT and SAML SSO, kept out of the minimal payload.
Import/export country, position, seniority, daily salary, studio and
departments; invalid values fail the row (400). Typed columns accept the
human label or the stored code, and studio/department names match exactly
(case-sensitive).

Factor the ISO 3166-1 country validation into a single normalize_country
helper shared by the model, API, CSV import and SAML SSO.
@NicoPennec NicoPennec merged commit d1020c1 into cgwire:main Jun 2, 2026
14 checks passed
@NicoPennec NicoPennec deleted the user-country branch June 2, 2026 15:36
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