Skip to content

Conversation

@loicguillois
Copy link
Collaborator

No description provided.

Integrate user type information from Portail DF API to categorize users
as 'prestataire', 'gestionnaire', or both.

- Add kind field to users table (migration)
- Fetch user type from Portail DF during authentication and user creation
- Add userKindService to handle Portail DF API integration
- Add sync script to update existing users
- Update user models to include kind field
Add the missing 'kind' property (string | null) to genUserDTO fixture
to match the updated UserDTO interface.

Fixes TypeScript compilation error:
Property 'kind' is missing in type but required in type 'UserDTO'.
Add the missing 'kind' property throughout the codebase:
- userRepository: Add kind to UserDBO interface and parsing functions
- accountController: Fix void return type issue from userRepository.update()
- seeds: Add kind: null to production and development user fixtures
- userKindService: Fix type assertion for API response
- fixtures: Add kind: null to genUserDTO

All TypeScript compilation errors resolved.
Add the 'kind' field to:
- fromUserDTO and toUserDTO functions in frontend
- User mock handler
- GroupApi test assertions
- Add multipart/form-data authentication to sync_user_kind.py script
- Add --username and --password CLI arguments for API credentials
- Implement retry with exponential backoff for API timeouts (3 retries)
- Increase API timeout to 30s for individual requests, 60s for auth
- Fix UUID cast in SQL update query (user_id::uuid)
- Update userKindService.ts to use FormData for authentication
The API requires token authentication instead of basic auth. Added
--username and --password as required arguments and implemented token
retrieval via /api-token-auth/ endpoint.
- Add BATCH_SIZE limit and batchedWhereIn helper to events seed to avoid
  PostgreSQL parameter limit being exceeded with large datasets
- Add config.cerema.enabled check in fetchUserKind to skip API calls
  when Cerema integration is disabled
Create updatedUser object once and reuse it for both userRepository.update()
and subsequent operations.

Addresses review comment from @Falinor about duplicated code.
…sers

feat(users): add user type classification from Portail DF
@tristanrobert
Copy link
Contributor

tristanrobert commented Jan 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

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.

4 participants