Skip to content

Implement Hitobito camp sync endpoints #10423

Description

@eliaSchenker

This issue specifies endpoints related to the Hitobito camp sync feature, which allows users to sync camps that have been linked to a Hitobito provider (i.e. MiData).

Sync Preview

The sync preview endpoint fetches the data from Hitobito and returns the new camp model, but does not persist the changes.

// GET /api/camps/<id>/hitobito_sync_preview

// Response
// <camp response model>

Implementation

  1. Check whether the specified camp exists
    1. If not, respond with 404 Not Found
  2. Check whether the user has access to the camp (at least role manager)
    1. If not, respond with 403 Forbidden
  3. Retrieve / verify access token
    1. See Implement Hitobito OAuth flow, Integrate Hitobito API #10400
  4. Check that the user has access to the specified event
    1. See Implement Hitobito event access control #10419
  5. Retrieve the event details from the Hitobito API as specified here: Implement Hitobito camp import endpoint #10387
    1. If an event doesn't exist anymore at Hitobito, respond with status 404 Not Found and a corresponding error code.
  6. Map the event properties to the existing camp as specified here: Implement Hitobito camp import endpoint #10387
  7. Respond with the camp model without updating the camp and 200 OK

Sync

// POST /api/camps/<id>/hitobito_sync

// Response
// <camp response model>

Implementation

Exact same workflow as Sync Preview, but persist the camp before responding. Also set the hitobitoLastSyncTime to the current datetime when updating the camp.
Respond with 200 OK

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions