Erste Produktivversion
This commit is contained in:
34
backend/app/schemas_push.py
Normal file
34
backend/app/schemas_push.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class PushConfigOut(BaseModel):
|
||||
enabled: bool
|
||||
# Der oeffentliche VAPID-Schluessel, base64url ohne Auffuellzeichen.
|
||||
public_key: str | None = None
|
||||
throttle_hours: int
|
||||
|
||||
|
||||
class PushKeys(BaseModel):
|
||||
p256dh: str = Field(max_length=200)
|
||||
auth: str = Field(max_length=100)
|
||||
|
||||
|
||||
class PushSubscribeIn(BaseModel):
|
||||
# Vom Push-Dienst des Browserherstellers vergebene URL.
|
||||
endpoint: str = Field(min_length=10, max_length=500)
|
||||
keys: PushKeys
|
||||
# Grobe Geraetebezeichnung zur Unterscheidung mehrerer Anmeldungen.
|
||||
label: str | None = Field(default=None, max_length=80)
|
||||
|
||||
|
||||
class PushUnsubscribeIn(BaseModel):
|
||||
endpoint: str = Field(min_length=10, max_length=500)
|
||||
|
||||
|
||||
class PushSubscriptionOut(BaseModel):
|
||||
id: str
|
||||
label: str | None
|
||||
created_at: datetime
|
||||
last_success_at: datetime | None
|
||||
Reference in New Issue
Block a user