From 1c76fb0684fc02013e1aa0a9cdddf20f261ac0a8 Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Thu, 23 May 2024 20:27:01 +0200 Subject: [PATCH] Remove overdrive --- .github/workflows/generate-docs.yaml | 4 +-- docs/s4-api-docs-od.md | 46 ---------------------------- docs/s4-api-docs.md | 31 +++++++++++++++++-- jury/index.html | 4 +-- src/events/constants.ts | 8 ++--- 5 files changed, 36 insertions(+), 57 deletions(-) delete mode 100644 docs/s4-api-docs-od.md diff --git a/.github/workflows/generate-docs.yaml b/.github/workflows/generate-docs.yaml index 16b50ef..64127c0 100644 --- a/.github/workflows/generate-docs.yaml +++ b/.github/workflows/generate-docs.yaml @@ -21,9 +21,7 @@ jobs: run: python -m pip install -U md2html-phuker - name: Generate HTML documentation - run: | - md2html docs/s4-api-docs.md - md2html docs/s4-api-docs-od.md + run: md2html docs/s4-api-docs.md - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/docs/s4-api-docs-od.md b/docs/s4-api-docs-od.md deleted file mode 100644 index 36b51db..0000000 --- a/docs/s4-api-docs-od.md +++ /dev/null @@ -1,46 +0,0 @@ -# \[OVERDRIVE\] Session 4 API Documentation - -This is the API documentation for the AEC 2024 Skill 08 Session 4 API. - -## Events - -The API provides an endpoint to subscribe to the actions of an event and sending an answer to a voting poll. - -### Subscribe to an Event - -This endpoint uses HTTP Long Polling, meaning the connection will remain open until an action is available. Clients should make a request to this endpoint and wait for a response. Once a response is received, the client should immediately make another request to continue receiving actions. - -For the initial request, it is possible to pass the query parameter `wait=false` to get the current action immediately. - -``` -GET /events/:id/subscribe -``` - -Example Response - -```json -{ - "action": { - "type": "vote", - "question": "Which protocol is used to transfer web pages over the internet?", - "answerA": "HTTP", - "answerB": "FTP" - } -} -``` - -### Answer a Poll - -This endpoint allows clients to answer a poll. The client should make a POST request to this endpoint with the answer in the request body. - -``` -POST /events/:id/vote -``` - -Request Body - -``` -{ - answer: "a" | "b" -} -``` diff --git a/docs/s4-api-docs.md b/docs/s4-api-docs.md index 6c78f26..5990a9d 100644 --- a/docs/s4-api-docs.md +++ b/docs/s4-api-docs.md @@ -4,7 +4,7 @@ This is the API documentation for the AEC 2024 Skill 08 Session 4 API. ## Events -The API provides an endpoint to subscribe to the actions of an event. +The API provides endpoints to subscribe to the actions of an event and to send an answer to a voting poll. ### Subscribe to an Event @@ -16,7 +16,7 @@ For the initial request, it is possible to pass the query parameter `wait=false` GET /events/:id/subscribe ``` -Example Response +Example Responses ```json { @@ -25,3 +25,30 @@ Example Response } } ``` + +```json +{ + "action": { + "type": "vote", + "question": "Which protocol is used to transfer web pages over the internet?", + "answerA": "HTTP", + "answerB": "FTP" + } +} +``` + +### Answer a Poll + +This endpoint allows clients to answer a poll. The client should make a POST request to this endpoint with the answer in the request body. + +``` +POST /events/:id/vote +``` + +Request Body + +``` +{ + answer: "a" | "b" +} +``` diff --git a/jury/index.html b/jury/index.html index 5e93bc2..18d0099 100644 --- a/jury/index.html +++ b/jury/index.html @@ -48,8 +48,8 @@

Jury Tool

const events = [ 'aeg-beneficiary-concert', 'pop-concert', - 'AEC-OC', - 'AEC-CC', + 'aec-oc', + 'aec-cc', ]; // Create html elements for each event diff --git a/src/events/constants.ts b/src/events/constants.ts index e694e47..b8907a7 100644 --- a/src/events/constants.ts +++ b/src/events/constants.ts @@ -3,18 +3,18 @@ export const actions = ['flashlight', 'vote']; export const events = [ { name: 'aeg-beneficiary-concert', - availableActions: ['flashlight'], + availableActions: ['flashlight', 'vote'], }, { name: 'pop-concert', - availableActions: ['flashlight'], + availableActions: ['flashlight', 'vote'], }, { - name: 'AEC-OC', + name: 'aec-oc', availableActions: ['flashlight', 'vote'], }, { - name: 'AEC-CC', + name: 'aec-cc', availableActions: ['flashlight', 'vote'], }, ];