CHANGE: docs

This commit is contained in:
2024-09-06 09:59:22 +02:00
parent 68608a995b
commit 5f2cd56325
3 changed files with 105 additions and 4 deletions

27
API.apib Normal file
View File

@@ -0,0 +1,27 @@
#Group Bookings
## Bookings Collection [/time{?cardID}]
### List all bookings for specific card_id [GET]
+ Parameters
+ cardID:test_card (string) - the id of the rfid card
+ Response 200 (application/json)
[
{
"cradID": "test_card",
"readerID": "test_reader",
"bookingTyp": 2,
"loggedTime": "2024-09-05T08:37:53.117641Z",
"id": 5
},
{
"cradID": "test_card",
"readerID": "mytest",
"bookingTyp": 1,
"loggedTime": "2024-09-05T08:51:12.670827Z",
"id": 6
},
]

View File

@@ -31,3 +31,5 @@ services:
EXPOSED_PORT: ${EXPOSED_PORT} EXPOSED_PORT: ${EXPOSED_PORT}
ports: ports:
- ${EXPOSED_PORT}:8080 - ${EXPOSED_PORT}:8080
depends_on:
- db

View File

@@ -5,9 +5,81 @@ bis jetzt ein einfaches Backend mit PostgreSQL Datenbank und GO Webserver um Arb
## Installation ## Installation
```bash ```bash
git clone https://git.letsstein.de/tom/arbeitszeitmessung git clone https://git.letsstein.de/tom/arbeitszeitmessung arbeitszeitmessung
# cd in das Verzeichnis cd arbeitszeitmessung/Docker
# .env Datei anpassen
cd Docker
docker compose up -d docker compose up -d
```
## API
Nutzung der API
### Buchungen [/time]
#### [GET] Anfrage
Parameter: cardID (string)
Antwort: `200`
```json
[
{
"cradID": "test_card",
"readerID": "test_reader",
"bookingTyp": 2,
"loggedTime": "2024-09-05T08:37:53.117641Z",
"id": 5
},
{
"cradID": "test_card",
"readerID": "mytest",
"bookingTyp": 1,
"loggedTime": "2024-09-05T08:51:12.670827Z",
"id": 6
},
]
```
Antwort `500`
Serverfehler
#### [PUT] Anfrage
Parameter: id (int)
Body: (veränderte Parameter)
```json
{
"cradID": "test_card",
"readerID": "mytest",
"bookingTyp": 1,
"loggedTime": "2024-09-05T08:51:12.670827Z",
}
```
Antwort `200`
```json
{
"cradID": "test_card",
"readerID": "mytest",
"bookingTyp": 1,
"loggedTime": "2024-09-05T08:51:12.670827Z",
"id": 6
}
```
### Neue Buchung [/time/new]
#### [PUT] Anfrage
Parameter:
- cardID (string)
- readerID (string)
- bookingType (string)
Antwort `202` Akzeptiert und eingefügt
```json
{
"cradID": "test_card",
"readerID": "mytest",
"bookingTyp": 1,
"loggedTime": "2024-09-05T08:51:12.670827Z",
"id": 6
}
```
Antwort `409` Konflikt
Die vorherige Buchung am selben Tag hat den gleichen Buchungstyp