CHANGE: Minor improvements + updated api docs

This commit is contained in:
2025-02-28 13:10:44 +01:00
parent 23cb312644
commit dafcd95428
8 changed files with 561 additions and 345 deletions

View File

@@ -1,74 +1,58 @@
openapi: 3.0.3
info:
title: Arbeitszeitmessung - OpenAPI 3.0
description: 'This demos the API for the Arbeitszeitmessung Project '
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
description: Docker Server
- url: http://localhost:8080
description: Local Development
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
summary: Gets all the bookings from one card_uid
description: Returns all the bookings optionally filtered with cardID
operationId: getBooking
parameters:
- name: card_uid
in: query
description: CardID to filter for
required: true
schema:
type: string
- name: time_from
in: query
description: Timestamp since when all bookings are shown (default=1 month ago)
required: false
schema:
type: string
example: "2025-02-28"
- name: time_to
in: query
description: Timestamp till when all bookings are shown (default=today)
required: false
schema:
type: string
example: "2025-02-28"
responses:
'200':
"200":
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Booking'
'400':
$ref: "#/components/schemas/BookingGrouped"
"400":
description: Invalid cardID
/time/new:
put:
@@ -78,6 +62,11 @@ paths:
description: Creates a new booking with the supplied parameters
operationId: pcreateBooking
parameters:
- in: header
name: Authorization
description: Predefined API Key to authorize access
schema:
type: string
- name: card_uid
in: query
description: id of the RFID card scanned
@@ -101,13 +90,13 @@ paths:
- 2
- 255
responses:
'200':
"200":
description: successfully created booking
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
'409':
$ref: "#/components/schemas/Booking"
"409":
description: Same booking type as last booking
get:
tags:
@@ -116,6 +105,17 @@ paths:
description: Creates a new booking with the supplied parameters
operationId: gcreateBooking
parameters:
- in: header
name: Authorization
description: Predefined API Key to authorize access
schema:
type: string
- in: query
name: api_key
description: Predefined API Key to authorize access
required: false
schema:
type: string
- name: card_uid
in: query
description: id of the RFID card scanned
@@ -139,13 +139,15 @@ paths:
- 2
- 255
responses:
'200':
"200":
description: successfully created booking
content:
application/json:
schema:
$ref: '#/components/schemas/Booking'
'409':
$ref: "#/components/schemas/Booking"
"401":
description: none or wrong api key provided!
"409":
description: Same booking type as last booking
/logout:
get:
@@ -155,16 +157,26 @@ paths:
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':
"200":
description: Succesful
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
$ref: "#/components/schemas/User"
components:
schemas:
BookingGrouped:
type: object
properties:
day:
type: string
format: date
bookings:
type: array
items:
$ref: "#/components/schemas/Booking"
Booking:
type: object
properties:
@@ -188,7 +200,7 @@ components:
timestamp:
type: string
format: date-time
example: '2024-09-05T08:51:12.670Z'
example: "2024-09-05T08:51:12.670Z"
xml:
name: booking
User: