From 8b2e042f620e392476494df422b1279e5037e1f1 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 19 Sep 2024 16:26:35 +0200 Subject: [PATCH] CHANGE: added get for create booking --- Backend/main.go | 2 ++ Docker/arbeitszeitmessung.json | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/Backend/main.go b/Backend/main.go index 776bef9..d35d350 100644 --- a/Backend/main.go +++ b/Backend/main.go @@ -33,6 +33,8 @@ func timeCreateHandler(w http.ResponseWriter, r *http.Request) { switch r.Method { case "PUT": createBooking(w, r) + case "GET": + createBooking(w, r) case "OPTIONS": w.WriteHeader(http.StatusOK) default: diff --git a/Docker/arbeitszeitmessung.json b/Docker/arbeitszeitmessung.json index 96ebf83..846790f 100644 --- a/Docker/arbeitszeitmessung.json +++ b/Docker/arbeitszeitmessung.json @@ -155,6 +155,57 @@ "description": "Same booking type as last booking" } } + }, + "get": { + "tags": ["booking"], + "summary": "Create new Booking", + "description": "Creates a new booking with the supplied parameters", + "operationId": "createBooking", + "parameters": [ + { + "name": "card_uid", + "in": "query", + "description": "id of the RFID card scanned", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "geraet_id", + "in": "query", + "description": "id of the RFID reader scanning the card", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "check_in_out", + "in": "query", + "description": "booking Type", + "required": true, + "schema": { + "type": "integer", + "enum": [1, 2, 255] + } + } + ], + "responses": { + "200": { + "description": "successfully created booking", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Booking" + } + } + } + }, + "409": { + "description": "Same booking type as last booking" + } + } } } },