summaryrefslogtreecommitdiff
path: root/app/schemas.py
blob: e40b0d3101d102362f3e587c804fd3af62545515 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pydantic import BaseModel, Field


class DeviceRegisterIn(BaseModel):
    user_id: str
    apns_token: str = Field(min_length=16)
    apns_env: str
    bundle_id: str
    platform: str = "ios"
    app_version: str | None = None
    device_name: str | None = None


class DeviceOut(BaseModel):
    id: int
    user_id: str
    bundle_id: str
    apns_env: str
    is_enabled: bool


class SubscriptionIn(BaseModel):
    source_type: str
    source_id: str
    event_type: str
    is_enabled: bool = True


class SubscriptionUpsertIn(BaseModel):
    device_id: int
    subscriptions: list[SubscriptionIn]