86 lines
2.5 KiB
Plaintext
86 lines
2.5 KiB
Plaintext
Plan:
|
|
Hardware:
|
|
Raspberry Pi 3/4
|
|
Smartcard reader + Mifare DESFire
|
|
Nuki Smart Lock Go
|
|
ESP32 + Nuki hub
|
|
Models
|
|
User
|
|
ID int
|
|
Name str
|
|
Email str
|
|
Password str (hashed)
|
|
IsAdmin bool
|
|
Card
|
|
ID int
|
|
UUID str
|
|
UserID int
|
|
AccessAuthorization
|
|
Name str
|
|
CardID list[Card]
|
|
IsActive bool
|
|
Timeslot list[Timeslot]
|
|
Door
|
|
Name str
|
|
IsLocked bool
|
|
IsClosed bool
|
|
Timeslot
|
|
Name str
|
|
WeekDay int
|
|
Starttime str(HH:MM)
|
|
Duration int (min)
|
|
|
|
API Specification
|
|
/door
|
|
Current status
|
|
GET
|
|
With header: access token
|
|
|
|
/door/unlock
|
|
Unlocks the door
|
|
POST
|
|
With header: access token (all)
|
|
restricted by schedule
|
|
/door/lock
|
|
Locks the door
|
|
POST
|
|
With header: access token (all)
|
|
not restricted by schedule
|
|
|
|
/user
|
|
List users
|
|
GET
|
|
With header: access token (all)
|
|
|
|
/user
|
|
Create users
|
|
POST
|
|
With header: access token (admin)
|
|
|
|
/user/{name}
|
|
Get user details
|
|
GET
|
|
With header: access token (admin)
|
|
/user/{name}
|
|
Delete user
|
|
DELETE #Didnt even know this was a http method
|
|
With header: access token (admin)
|
|
/user/{name}
|
|
change user details
|
|
PATCH
|
|
With header: access token (admin)
|
|
|
|
USER Parameters
|
|
{
|
|
"name": $name
|
|
"role": user or admin
|
|
"password": $password #dont send in answers
|
|
"schedule": siehe zeitplan
|
|
}
|
|
|
|
zeitplan
|
|
Hier bin ich nicht sicher, ich denke an cron style für wiederholende dinge aber das kann nur zeitpunkte und keine blöcke.
|
|
Villeicht ne liste von cron zeiten [ "0 16 * * 2" "0 18 * * 2" ](Wäre dienstag 16-18 uhr) - Ist aber warscheinlich schwer zu parsen
|
|
Oder startzeit + länge in minuten [ "0 16 "* * 2" "120" ]
|
|
Ganz simpel ["wochentag(1-7)" "Startzeit" "Endzeit"]
|
|
Was ist mit "aller 2 wochen" oder "3. Sonntag im monat" |