Skip to content
Snippets Groups Projects
  1. May 09, 2022
  2. May 04, 2022
  3. May 03, 2022
  4. Apr 24, 2022
    • Konrad Mohrfeldt's avatar
      fix: align schedule create/update conflict responses with documentation · 3af360ec
      Konrad Mohrfeldt authored
      The conflict responses should be send with an HTTP 409 status code as
      they’re defined in our documentation. This was not the case as the
      dashboard couldn’t handle these error codes, but is now fixed in
      dashboard@4a07ad9e.
      3af360ec
    • Konrad Mohrfeldt's avatar
      feat: allow single request scheduling · 293c78c5
      Konrad Mohrfeldt authored
      Until now the steering API client was expected to submit two requests.
      
      1. The initial schedule request, with a `schedule` object
      2. A second schedule request, with an additional `solutions` object
      
      This `solutions` object was empty, if no conflicts arose from the
      submitted schedule in the first place. But instead of just creating the
      requested schedule if no conflicts were detected we still required that
      second round-trip, introducing possible race conditions in the client,
      if another successful scheduling request was made between requests.
      
      From now on the steering API will create schedules if no conflicts have
      been detected and will only require the client to submit solutions if
      there really are conflicts to solve.
      293c78c5
    • Konrad Mohrfeldt's avatar
      refactor: update schedule REST API attribute names and documentation · 51be0fbe
      Konrad Mohrfeldt authored
      The following attribute names were marked as deprecated in the schedule
      request and have been replaced by their new names:
      
        dstart → first_date
        until → last_date
        tstart → start_time
        tend → end_time
        byweekday → by_weekday
      
      Apart from that this commit fixes a few documentation errors.
      51be0fbe
  5. Apr 23, 2022
  6. Apr 15, 2022
  7. Apr 14, 2022
  8. Apr 11, 2022
    • Ernesto Rico Schmidt's avatar
      Update requirements · df7efd08
      Ernesto Rico Schmidt authored
      - asgiref
      - Django
      - drf_spectacular
      - Pillow
      - pre-commit
      - pycryptodomex
      - pyparsing
      - pytest
      - python-magic
      - pytz
      - urllib3
      df7efd08
  9. Apr 07, 2022
  10. Apr 05, 2022
  11. Mar 30, 2022
  12. Mar 29, 2022
  13. Mar 28, 2022
    • Konrad Mohrfeldt's avatar
      fix: don’t enforce valid instance references in collection filters · a5239bfb
      Konrad Mohrfeldt authored
      If a collection is filtered by an invalid id (meaning the model the
      query argument points to with that specific id does not exist), we no
      longer return an error. Instead the filter is applied without a lookup.
      
      Fixes #104
      a5239bfb
    • Konrad Mohrfeldt's avatar
      CI: add autogenerated openapi.yaml file · 88595646
      Konrad Mohrfeldt authored
      The CI should now automatically build an openapi.yaml file of the API
      schema that is stored as an artifact.
      88595646
    • Konrad Mohrfeldt's avatar
      feat: add schema documentation with drf-spectacular · ec08012b
      Konrad Mohrfeldt authored
      This adds extensive API documentation based on the official API
      documentation [1] and conflict resolution [2] documents.
      
      Where possible field documentation was added to models or serializers,
      so that other code like auto-generated forms can also profit from these
      changes (hence the migration part of this commit).
      
      The changes introduce two new API endpoints.
      
      `/api/v1/schema/` exposes the API schema as an OpenAPI 3.0.3 document.
      The standard format is yaml but can be switched to JSON by appending the
      `?format=json` query parameter.
      
      `/api/v1/schema/swagger-ui/` renders a visual representation of the
      OpenAPI 3 specification with support for testing the individual API
      endpoints including authentication.
      
      [1]
      https://gitlab.servus.at/aura/meta/-/blob/ec3c753d34ccb0269969808ac7dc28fff2ff1648/docs/development/api-definition.md
      [2]
      https://gitlab.servus.at/aura/meta/-/blob/ec3c753d34ccb0269969808ac7dc28fff2ff1648/docs/development/conflict-resolution.md
      ec08012b
    • Konrad Mohrfeldt's avatar
      feat: add new syntaxes for filtering by choices · edf2cf78
      Konrad Mohrfeldt authored
      In addition to the
      
      	?foo=1,2,3
      
      filter syntax we now also support
      
      	?foo=1&foo=2&foo=3
      	?foo[]=1&foo[]=2&foo[]=3
      edf2cf78
    • Konrad Mohrfeldt's avatar
      feat: return schedule dry-runs with a separate status code · b82b0435
      Konrad Mohrfeldt authored
      Schedule dry-runs returned a 201 response before, because the only check
      for a 201 return code was, that the payload must not contain the
      "projected" keyword.
      
      As dry-runs don’t create any data 201 is not an appropriate status code.
      b82b0435
    • Konrad Mohrfeldt's avatar
      fix: don’t restrict timeslot queryset on detail views · 3c38698a
      Konrad Mohrfeldt authored
      The filter defaults caused the queryset to always yield results filtered
      for the coming 60 days. We should only apply filter defaults when
      listing timeslots, not when querying individual items.
      3c38698a
    • Konrad Mohrfeldt's avatar
      fix: remove superfluous retrieve/update actions for APIUserViewSet · 5bc1f22b
      Konrad Mohrfeldt authored
      The retrieve and update actions can be removed because the get_queryset
      method already ensures that the user has only access to their own user
      object (or all user objects in case of superusers).
      
      Sending 401 responses for unauthorized requests may also be considered
      leaky, because it exposes that these objects exist instead of returning
      a 404 that simply states that no object with that primary key can be
      found.
      5bc1f22b
    • Konrad Mohrfeldt's avatar
      fix: always include API fields · 78168ae2
      Konrad Mohrfeldt authored
      Simply omitting properties in the API in certain edge cases makes API
      client implementations brittle and documentation a lot harder.
      78168ae2
    • Konrad Mohrfeldt's avatar
      fix: raise ValidationError on invalid data · e2cc7bb9
      Konrad Mohrfeldt authored
      This gives the calling code better control over the handling of such
      errors and makes it easy to differentiate between errors and valid
      return types.
      e2cc7bb9
    • Konrad Mohrfeldt's avatar
      feat: API errors now come with an optional code · 59219ebf
      Konrad Mohrfeldt authored
      This change allows clients to identify specific errors by an optional
      code provided as part of any APIException instances raised in our code.
      
      This code:
      
      ```py
      raise ValidationError(
          "Please provide a correct date and time",
          code="time-invalid",
      )
      ```
      
      now returns an error object via the API with a message and a code
      property making error processing on the client side easy for both humans
      and machines and looks like this:
      
      ```json
      {
          "message": "Please provide a correct date and time",
          "code": "time-invalid"
      }
      ```
      59219ebf
    • Konrad Mohrfeldt's avatar
      refactor: move subroute filtering into viewset mixin · a0e800d9
      Konrad Mohrfeldt authored
      Most of the queryset filtering for subroutes formerly implemented
      through custom get_queryset methods can happen semi-automated through a
      mixin, making the behaviour re-usable and allowing us strip a lot of
      additional logic for retrieving objects.
      
      The use of the viewset get_object method also allows us to implement
      object access with permission classes in the future, and should make a
      whole lot of other code obselete.
      
      This change is primarily motivated by the fact that documentation of the
      API will become a lot easier if the subroutes don’t impose arbitrary
      restrictions on the specific subpath under which an operation is
      allowed. For instance updating a schedule should be possible through
      either /schedules/<pk>/ or
      /shows/<show_pk>/schedules/<schedule_pk>/ as long as all the necessary
      data is present in the request body.
      a0e800d9
    • Konrad Mohrfeldt's avatar
      refactor: implement consistent pk/slug retrieval for shows · c650f609
      Konrad Mohrfeldt authored
      The show retrieve method allowed shows to be identified through the slug
      or the id. This is handy, but was restricted to the retrieve and did not
      apply to the update nor delete methods. The proper way to implement this
      kind of behaviour is through overriding get_object so that route
      identifiers are handled consistently.
      c650f609
    • Konrad Mohrfeldt's avatar
      fix: cba_id should be part of the serialized representation · 0d695cf1
      Konrad Mohrfeldt authored
      cba_id was always part of the serialized note representation through the
      use of `fields = "__all__"``and shouldn’t be write-only.
      0d695cf1
  14. Mar 25, 2022
Loading