api-erstellen #1

Merged
TorstenHettstedt merged 52 commits from api-erstellen into master 2021-04-07 13:00:46 +02:00
2 changed files with 340 additions and 0 deletions
Showing only changes of commit 9e2e94c116 - Show all commits
+1
View File
@@ -107,3 +107,4 @@ Temporary Items
/api/tests/acceptance
/api/tests/functional
/api/tests/*.suite.yml
/api/html/swagger/
+339
View File
@@ -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"
}
}
}
}
}
}
}