Implement Hitobito camp sync UI
- Dominant language
- PHP
- Stars
- 156
- Forks
- 72
- Avg merge
- 12h 43m
- Merged PRs (30d)
- 203
Description
Once a camp is linked with Hitobito, the user can sync event data from Hitobito to eCamp.
Relevant Endpoints:
- https://github.com/ecamp/ecamp3/issues/10386
- https://github.com/ecamp/ecamp3/issues/10400
## Implementation
Add a new section on the info page in the camp detail view:
- The section is only shown if `camp.hitobitoId` and `camp.hitobitoProvider` are set
- The text/logo adapts based on the provider of the camp
When the user clicks the synchronize button, initialize the OAuth flow as described here: https://github.com/ecamp/ecamp3/issues/10400 with the `callback=/camps///hitobito/sync`.
The user will be redirected to the consent screen and then to the sync page (`/camps///hitobito/sync`)
Once the page is loaded, fetch the event data `GET /api/hitobito//events/`
Compare the current camp data against the data returned by the event endpoint and display the following fields:
- `addressName`
- `motto`
- `title`
- `periods` (`description`, `start`, `end`)
If no data has changed, display the following screen:
Once the user confirms the synchronization, use the `PATCH /api/camps/` and `/api/periods` endpoints to adjust the data accordingly. Use the same mapping logic as described in https://github.com/ecamp/ecamp3/issues/10401
When the call completes, redirect back to the camp details page.
Notes:
- If any calls to the backend fail unexpectedly (forbidden, internal error), display an appropriate error message
Contributor guide
Assessment
This issue has not been assessed yet.