Verified Commit 0b4a31fd authored by Jakob Moser's avatar Jakob Moser
Browse files

Specify patch agenda

parent 577b224f
Loading
Loading
Loading
Loading
Loading
+99 −13
Changes for portal/static/docs/api/v0/openapi-spec.yaml: 99 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -27,24 +27,14 @@ paths:
                                    $ref: "#/components/schemas/AgendaItem"
                            examples:
                                a_short_agenda:
                                    value:
                                        - name: "Tagesordnung"
                                        - name: "Gremienberichte"
                                        - name: "Posteingang und Kummerkasten"
                                        - name: "Sommerfest: Planen (irgendwann noch offizielle Einladung)"
                                          taiga:
                                            id: 235
                                            status: 42
                                        - name: "Sommer-Coliwochenende: Veranstalten"
                                          taiga:
                                            id: 213
                                            status: 42
                                        - name: "Sonstiges"
                                    $ref: "#/components/examples/a_short_agenda"
                    description: Successful response, returns a list of items
                "401":
                    $ref: "#/components/responses/UnauthorizedError"
            operationId: getTheAgendaItems
            summary: List all items on the agenda
            security:
                - secretBearerAuth: []
            description: |
                This returns all items currently on the agenda for a Fachschaftssitzung. A few of the standard items are auto-generated, the rest is directly sourced from the todo tool _Taiga_ ([fsco.li/todo](https://fsco.li/todo)).

@@ -66,6 +56,77 @@ paths:

                However, we currently don't model multiple agendas (and maybe never will). To still keep the pattern, we therefore used an id of `-` to signify something like “_the one_ agenda, like, you know what we're talking about”. Should we ever introduce several agendas, distinguished
                by ids, we could in a compatible way adjust the API to also allow actual ids in the path.
        patch:
            requestBody:
                required: true
                content:
                    application/json:
                        schema:
                            type: array
                            items:
                                $ref: "#/components/schemas/AgendaItem"
                        examples:
                            minimal_patch:
                                value:
                                    taiga:
                                        id: 213
                                        status: 41
                            usual_patch:
                                value:
                                    - name: "Tagesordnung"
                                    - name: "Gremienberichte"
                                    - name: "Posteingang und Kummerkasten"
                                    - name: "Sommerfest: Planen (irgendwann noch offizielle Einladung)"
                                      taiga:
                                          id: 235
                                          status: 42
                                    - name: "Sommer-Coliwochenende: Veranstalten"
                                      taiga:
                                          id: 213
                                          status: 41
                                    - name: "Sonstiges"
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                type: array
                                items:
                                    $ref: "#/components/schemas/AgendaItem"
                            examples:
                                a_shorter_agenda:
                                    $ref: "#/components/examples/a_shorter_agenda"
                    description: |-
                        All agenda items (including the updated ones), just as if someone made a GET request.
                "400":
                    $ref: "#/components/responses/BadRequestError"
                "401":
                    $ref: "#/components/responses/UnauthorizedError"
            operationId: patchTheAgendaItems
            summary: Change items on the agenda
            security:
                - secretBearerAuth: []
            description: |
                This changes the status of the specified items currently on the agenda for a Fachschaftssitzung sourced from Taiga.

                Items without a `taiga` reference in the list are ignored. For items with a `taiga` reference, everything but the reference is ignored.
                The `taiga.id` field is used to identify the user stories in Taiga, whose statuses are updated according to the `taiga.status` field.
                Then, the agenda is re-retrieved from Taiga (just like with the `GET` path) and returned.

                ### Permission concept: Auditability

                Any logged-in user can change the status of an item. When the status of an item is changed, a comment with the name of the user is posted
                in the item. This should be most comfortable (anyone in the meeting will be able to change items, with no further administrative efforts required),
                while still limiting abuse: If a notorious user were to persistently mis-use, they could either be technically blocked, or in some other
                form socially reprimanded (e.g. by being sent a sternly worded message to stop).

                ### Is there a way to only change a single item (or a subset of it)?

                Sure. Just only include them in the request body and the rest will be left untouched.

                ### Can I change any item with this?

                Yes. The audit concept should make sure that if someone uses this to change the state of random other items, it is caught soon enough. Then, measures can still be implemented to taste.
    /version:
        summary: Path used to get details about the version of this application.
        description: ""
@@ -248,6 +309,31 @@ components:
                createdAt: "2023-04-16T18:36:23+00:00"
                expiresAt: "2023-04-16T19:36:23+00:00"
                userUuid: 75e9ec37-54ff-4da3-b5cb-68e1870be3c0
    examples:
        a_short_agenda:
            value:
                - name: "Tagesordnung"
                - name: "Gremienberichte"
                - name: "Posteingang und Kummerkasten"
                - name: "Sommerfest: Planen (irgendwann noch offizielle Einladung)"
                  taiga:
                      id: 235
                      status: 42
                - name: "Sommer-Coliwochenende: Veranstalten"
                  taiga:
                      id: 213
                      status: 42
                - name: "Sonstiges"
        a_shorter_agenda:
            value:
                - name: "Tagesordnung"
                - name: "Gremienberichte"
                - name: "Posteingang und Kummerkasten"
                - name: "Sommerfest: Planen (irgendwann noch offizielle Einladung)"
                  taiga:
                      id: 235
                      status: 42
                - name: "Sonstiges"
    responses:
        UnauthorizedError:
            description: |-