From 9e2e94c116221ef2b5c8a196f295f6d286511546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20L=C3=BCcke?= Date: Fri, 26 Mar 2021 12:47:38 +0100 Subject: [PATCH] Definition der HTTP-Abfragen fertig. --- .gitignore | 1 + api/html/openapi.json | 339 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 340 insertions(+) create mode 100644 api/html/openapi.json diff --git a/.gitignore b/.gitignore index c8deedb..02e1df6 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,4 @@ Temporary Items /api/tests/acceptance /api/tests/functional /api/tests/*.suite.yml +/api/html/swagger/ diff --git a/api/html/openapi.json b/api/html/openapi.json new file mode 100644 index 0000000..6af9f42 --- /dev/null +++ b/api/html/openapi.json @@ -0,0 +1,339 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Zeiterfassung App", + "contact": { + "name": "Torsten Lücke", + "url": "http://torsten-hettstedt.de", + "email": "arbeit@torsten-hettstedt.de" + }, + "license": { + "name": "GPL-2.0-or-later" + }, + "version": "1.0.0" + }, + "paths": { + "/working-hours": { + "get": { + "tags": [ + "Eintragungen Arbeitszeiten" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ListEntities" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + }, + "post": { + "tags": [ + "Eintragungen Arbeitszeiten" + ], + "requestBody": { + "$ref": "#/components/requestBodies/WorkingHours" + }, + "responses": { + "201": { + "$ref": "#/components/responses/ReadEntity" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "409": { + "$ref": "#/components/responses/RecordAlreadyExistsException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + } + }, + "/working-hours/{date}" : { + "get": { + "tags": [ + "Eintragungen Arbeitszeiten" + ], + "parameters": [ + { + "$ref": "#/components/parameters/date" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ListEntities" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "404": { + "$ref": "#/components/responses/RecordNotFoundException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + }, + "put": { + "tags": [ + "Eintragungen Arbeitszeiten" + ], + "parameters": [ + { + "$ref": "#/components/parameters/date" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/WorkingHours" + }, + "responses": { + "200": { + "$ref": "#/components/responses/ReadEntity" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "404": { + "$ref": "#/components/responses/RecordNotFoundException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + } + }, + "/views/working-hours/weekly": { + "get": { + "tags": [ + "Ansichten Arbeitszeiten" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ListEntitiesView" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + } + }, + "/views/working-hours/monthly": { + "get": { + "tags": [ + "Ansichten Arbeitszeiten" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ListEntitiesView" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + } + }, + "/views/working-hours/yearly": { + "get": { + "tags": [ + "Ansichten Arbeitszeiten" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ListEntitiesView" + }, + "400": { + "$ref": "#/components/responses/DatabaseException" + }, + "500": { + "$ref": "#/components/responses/ServerException" + } + } + } + } + }, + "components": { + "schemas": { + "WorkingHours": { + "description": "Eintrag der Arbeitszeit für einen Tag", + "type": "object", + "properties": { + "date": { + "description": "Datum eines Arbeitstages", + "type": "string", + "format": "date" + }, + "workingHours": { + "description": "Arbeitszeit des Tages", + "type": "integer" + } + } + }, + "WorkingHoursView": { + "type": "object", + "readOnly": true, + "properties": { + "period": { + "description": "Angabe des angegebenen Zeitraumes", + "type": "string" + }, + "periodDesignation": { + "description": "Bezeichnung des Zeitraumes", + "type": "string", + "enum": [ + "weekly", + "monthly", + "yearly" + ] + }, + "totalHours": { + "description": "Gesamte Arbeitszeit im Zeitraum", + "type": "string", + "format": "time" + }, + "workingDays": { + "description": "Arbeitstage im Zeitraum", + "type": "integer" + }, + "overtime": { + "description": "Überstunden im Zeitraum", + "type": "string", + "format": "time" + } + } + }, + "ErrorObject": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time" + }, + "status":{ + "type": "integer" + }, + "error": { + "type": "string" + }, + "message":{ + "type": "string" + }, + "path":{ + "type": "string", + "format": "path" + } + } + } + }, + "requestBodies": { + "WorkingHours": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkingHours" + } + } + } + } + }, + "parameters": { + "date" : { + "description": "Datum eines Eintrages", + "name": "date", + "in" : "path", + "required": true, + "schema": { + "type": "string", + "format": "date" + } + } + }, + "responses": { + "ListEntities": { + "description": "Liste der Einträge", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkingHours" + } + } + } + } + }, + "ReadEntity": { + "description": "Der Eintrag", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkingHours" + } + } + } + }, + "ListEntitiesView": { + "description": "Liste der Einträge", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkingHoursView" + } + } + } + } + }, + "RecordNotFoundException": { + "description": "Der Eintrag wurde nicht gefunden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorObject" + } + } + } + }, + "RecordAlreadyExistsException": { + "description": "Für das Datum wurde schon eine Arbeitszeit definiert", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorObject" + } + } + } + }, + "DatabaseException": { + "description": "Fehler in der Datenbank-Abfrage", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorObject" + } + } + } + }, + "ServerException": { + "description": "Fehler des Webservers", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorObject" + } + } + } + } + } + } +} \ No newline at end of file