Skip to content

Draft: die-linke-app-frontend#108 Add Event Invitation for also assign event-area

⚠️ ⚠️ Warning ⚠️ ⚠️

This adds the endpoint api/v1/event-areas/<event_area_id>/generate-invitation-token (which should just be called by coordinators/event owners), which returns something like:

{
  "data": {
    "token": "vDYKiWF-olkCki5hk3tqD9SspgFQKPIEOpQIyFmF7NU",
    "expires_at": "2025-12-02T13:47:06.652837+01:00"
  }
}

This token can then be use by the same endpoint as for events: /api/v1/events/validate-invitation-token/, therefore you need to pass the token inside a JSON body.

Curl example command
curl -X 'POST' \
  'http://localhost:8000/api/v1/events/validate-invitation-token/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFToken: cgAO2HQpefEMNHXMj5ZU2avh5ZN58MIAixczY6Il26Cj8Zj04RL1foJAtsbqRMfH' \
  -d '{
  "token": "vDYKiWF-olkCki5hk3tqD9SspgFQKPIEOpQIyFmF7NU"
}'

Which returns the existing/modified event participation of the user, which looks something like this

{
  "data": {
    "id": 89,
    "user": 1,
    "is_verified": true,
    "is_pending_invitation": false,
    "event": 5,
    "user_is_member": true,
    "user_email": "admin@example.com",
    "user_username": "admin",
    "inviting_users": [
      1
    ],
+   "assigned_event_areas": [
+     4
+   ],
    "is_team_captain": true,
    "is_event_coordinator": true
  }
}

Info

Since this requires a DB migration, you need to execute python manage.py migrate or docker:

docker-compose exec api python manage.py migrate

Caution

For generating a token you're then having two endpoints:

  1. api/v1/events/\<event_id\>/generate-invitation-token/ (requires cooridinator permission, teamcaptain is not sufficient)
  2. api/v1/event-areas/<event_area_id>/generate-invitation-token (requires cooridinator permission, teamcaptain is not sufficient)

but just one endpoints for validation /api/v1/events/validate-invitation-token/ (requires user to be authenticated)

related: die-linke-app-frontend#108

Edited by control.alt.coop eG (Peter)

Merge request reports

Loading