Problem
CountryDto exposes allow-flags that are derived aliases in country-dto.mapper.ts, and one alias is misleading:
nationalityAllowed is mapped from the entity column nationalityStepEnable.
nationalityStepEnable is read nowhere in the backend (only defined on the entity and used in this mapper).
- The actual nationality validation uses a different column,
nationalityEnable (kyc.service.ts, getNationalityErrors / getIdentCheckErrors).
So no CountryDto field reflects the real nationality gate. A client that filters its nationality picker by nationalityAllowed filters by a dead flag, and its UI can silently diverge from backend enforcement for any country where the two columns differ.
For reference, the correct mapping for the address/residence country is kycAllowed = dfxEnable (enforced in user-data.service.ts updatePersonalData), and locationAllowed = ipEnable gates the request IP's country, not a user-entered field.
Secondary
displayOrder is consumed by clients (e.g. realunit-app picker ordering), but no displayOrder column exists on the Country entity or in any migration — clients always receive undefined.
Suggested fix
- Fix the mapper to use
nationalityEnable, or expose nationalityEnable as its own DTO field; remove nationalityAllowed if nationalityStepEnable is genuinely unused.
- Either add a real
displayOrder column or stop documenting/consuming it.
Context
Found during a deep audit of the realunit-app country pickers (DFXswiss/realunit-app#519), which had to be corrected because the DTO flag names do not match enforced semantics.
Problem
CountryDtoexposes allow-flags that are derived aliases incountry-dto.mapper.ts, and one alias is misleading:nationalityAllowedis mapped from the entity columnnationalityStepEnable.nationalityStepEnableis read nowhere in the backend (only defined on the entity and used in this mapper).nationalityEnable(kyc.service.ts,getNationalityErrors/getIdentCheckErrors).So no
CountryDtofield reflects the real nationality gate. A client that filters its nationality picker bynationalityAllowedfilters by a dead flag, and its UI can silently diverge from backend enforcement for any country where the two columns differ.For reference, the correct mapping for the address/residence country is
kycAllowed=dfxEnable(enforced inuser-data.service.tsupdatePersonalData), andlocationAllowed=ipEnablegates the request IP's country, not a user-entered field.Secondary
displayOrderis consumed by clients (e.g. realunit-app picker ordering), but nodisplayOrdercolumn exists on theCountryentity or in any migration — clients always receiveundefined.Suggested fix
nationalityEnable, or exposenationalityEnableas its own DTO field; removenationalityAllowedifnationalityStepEnableis genuinely unused.displayOrdercolumn or stop documenting/consuming it.Context
Found during a deep audit of the realunit-app country pickers (DFXswiss/realunit-app#519), which had to be corrected because the DTO flag names do not match enforced semantics.