Commit 980ca6f4 authored by Martin Juhás's avatar Martin Juhás
Browse files

change: move the username from request body to request path

### Changes

* `GET /progress/` changed to `GET /progress/<username>/`

Closes #546
parent a123840c
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -299,21 +299,16 @@ paths:
          $ref: "#/components/responses/Success"
        '500':
          $ref: "#/components/responses/Error"
  /progress/:
  /progress/{username}:
    get:
      tags:
        - trainee-progress
      requestBody:
      parameters:
        - name: username
          in: path
          required: true
        content:
          application/json:
          schema:
              type: object
              properties:
                username:
            type: string
              required:
                - username
      responses:
        '200':
          $ref: "#/components/responses/TraineeProgressResponse"
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ urlpatterns = [
        name="create-sandbox-log",
    ),
    path(
        "progress/",
        "progress/<str:username>/",
        views.TraineeProgressView.as_view(),
        name="get-trainee-progress",
    ),
+2 −1
Original line number Diff line number Diff line
@@ -109,7 +109,8 @@ class TraineeProgressView(APIView):
    @protected(User.AuthGroup.ADMIN, EndpointPermissions.GET_TRAINEE_PROGRESS)
    def get(self, request, *args, **kwargs):
        """Retrieve the progress of the given trainee"""
        username = request.data.get("username", None)
        username = self.kwargs.get("username", None)
        print(username)
        if username is None:
            raise ApiException(
                "Invalid request, missing required `username` parameter"