Files
eventlens/backend/app/schemas.py
T
2026-04-09 19:00:12 +02:00

81 lines
1.8 KiB
Python

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from app.models import NotificationStatus, NotificationType, RegionScope, WatchType
class WatchItemCreate(BaseModel):
name: str = Field(min_length=2, max_length=255)
watch_type: WatchType
region_scope: RegionScope
notes: str | None = None
class WatchItemUpdate(BaseModel):
name: str | None = Field(default=None, min_length=2, max_length=255)
watch_type: WatchType | None = None
region_scope: RegionScope | None = None
notes: str | None = None
is_active: bool | None = None
class WatchItemRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
watch_type: WatchType
region_scope: RegionScope
notes: str | None
is_active: bool
created_at: datetime
updated_at: datetime
class PurchaseUpdate(BaseModel):
is_ticket_purchased: bool
class TrackedEventRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
watch_item_id: int
source: str
external_id: str
title: str
matched_term: str
venue_name: str | None
city: str | None
country_code: str | None
event_date: datetime | None
ticket_url: str | None
image_url: str | None
is_ticket_purchased: bool
purchased_at: datetime | None
discovery_notified_at: datetime | None
reminder_notified_at: datetime | None
first_seen_at: datetime
last_seen_at: datetime
class NotificationLogRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
tracked_event_id: int
notification_type: NotificationType
status: NotificationStatus
message: str
created_at: datetime
class SyncResult(BaseModel):
scanned_watch_items: int
new_events: int
updated_events: int
notifications_sent: int
notifications_skipped: int