293 lines
6.0 KiB
JSON
293 lines
6.0 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "Arbeitszeitmessung - OpenAPI 3.0",
|
|
"description": "This demos the API for the Arbeitszeitmessung Project ",
|
|
"version": "0.1.0"
|
|
},
|
|
"externalDocs": {
|
|
"description": "Git-Repository",
|
|
"url": "https://git.letsstein.de/tom/arbeitszeitmessung"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://localhost:8000"
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"name": "booking",
|
|
"description": "all Bookings"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/time": {
|
|
"put": {
|
|
"tags": ["booking"],
|
|
"summary": "Update a existing booking",
|
|
"description": "Update an existing booking by Id",
|
|
"operationId": "updateBooking",
|
|
"parameters": [
|
|
{
|
|
"name": "counter_id",
|
|
"in": "query",
|
|
"description": "Booking ID to update",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"description": "Update an existent booking in the db. Not all values have to be updated",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Booking"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Booking Updated",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Booking"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid ID supplied"
|
|
},
|
|
"500": {
|
|
"description": "Server Error"
|
|
}
|
|
}
|
|
},
|
|
"get": {
|
|
"tags": ["booking"],
|
|
"summary": "Gets all the bookings limited",
|
|
"description": "Returns all the bookings optionally filtered with cardID",
|
|
"operationId": "getBooking",
|
|
"parameters": [
|
|
{
|
|
"name": "card_uid",
|
|
"in": "query",
|
|
"description": "CardID to filter for",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful operation",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Booking"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Invalid cardID"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/time/new": {
|
|
"put": {
|
|
"tags": ["booking"],
|
|
"summary": "Create new Booking",
|
|
"description": "Creates a new booking with the supplied parameters",
|
|
"operationId": "pcreateBooking",
|
|
"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"
|
|
}
|
|
}
|
|
},
|
|
"get": {
|
|
"tags": ["booking"],
|
|
"summary": "Create new Booking",
|
|
"description": "Creates a new booking with the supplied parameters",
|
|
"operationId": "gcreateBooking",
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logout": {
|
|
"get": {
|
|
"tags": ["booking"],
|
|
"summary": "Logs out all logged in users",
|
|
"description": "With this call all actively logged in users (last booking today has check_in_out=1) will be logged out automaticly (check_in_out=255)",
|
|
"operationId": "autoLogout",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Succesful",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"Booking": {
|
|
"type": "object",
|
|
"properties": {
|
|
"counter_id": {
|
|
"type": "integer",
|
|
"format": "int64",
|
|
"example": 100
|
|
},
|
|
"card_uid": {
|
|
"type": "string",
|
|
"example": "test_card"
|
|
},
|
|
"geraet_id": {
|
|
"type": "string",
|
|
"example": "test_reader"
|
|
},
|
|
"check_in_out": {
|
|
"type": "integer",
|
|
"example": 1,
|
|
"enum": [1, 2, 255]
|
|
},
|
|
"timestamp": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"example": "2024-09-05T08:51:12.670Z"
|
|
}
|
|
},
|
|
"xml": {
|
|
"name": "booking"
|
|
}
|
|
},
|
|
"User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"card_uid": {
|
|
"type": "string",
|
|
"example": "test_card"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "Mustermann"
|
|
},
|
|
"vorname": {
|
|
"type": "string",
|
|
"example": "Max"
|
|
},
|
|
"hauptbeschäftigungsort": {
|
|
"type": "integer",
|
|
"format": "int8",
|
|
"example": 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|