Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.93 KB

README.md

File metadata and controls

47 lines (33 loc) · 1.93 KB

Pollack

This is only the Pollack a part of Pollock.

Pollock is a specification for a REST API based on the OpenAPI Specification 3 (OAS3).

Pollock can be used to create polls, participate in them and modify them. Normally, the polls can be locked, so that only registered users can participate.

The name is composed of poll and lock and is the name of a fish, the pollock. A special thing about this fish is that it is also called pollack. If Pollock was implemented without registration, then it would therefore be called Pollack, because registration is lacking.

Install

yarn install --dev

yarn run dev

Generate Client code (not needed)

Run the code below (adapting YAML_FILE_PATH to your file system path), if you want to newly generate client code

#  yarn add swagger-node-codegen
cd backend
YAML_FILE_PATH="../../../Moodle/Webprogrammierung (SoSe 23)/Projekt"

YAML_FILE_NAME="Pollack.yaml"  # part 1
# YAML_FILE_NAME="Pollock.yaml"  # part 2 

node_modules/.bin/snc  --output generated-frontend "${YAML_FILE_PATH}/${YAML_FILE_NAME}"

Test

Show statistics to a poll (No longer works - must be adapted to the new database/.sql):

curl --request POST --header "Content-Type: application/json" http://localhost:3000/poll/lack/e6f79f06-f280-11ed-b574-325096b39f47

Vote on a poll (No longer works - must be adapted to the new database/.sql):

curl --request POST --header "Content-Type: application/json" http://localhost:3000/vote/lack/e6f79f06-f280-11ed-b574-325096b39f47 --data '{"owner": {"name": "first!1", "lock": false}, "choice": [{"id": 1, "worst": false}]}'

(no longer accurate - must be adapted to the new database/.sql)

{"owner": {"name": "first!1", "lock": false}, "choice": [{"id": 1, "worst": false}]}