61 lines
1.1 KiB
Python
61 lines
1.1 KiB
Python
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from database.models import TicketStatus
|
|
|
|
class YookassaWebhookObject(BaseModel):
|
|
id: str
|
|
status: str
|
|
paid: bool
|
|
|
|
class YookassaWebhook(BaseModel):
|
|
event: str
|
|
type: str
|
|
object: YookassaWebhookObject
|
|
|
|
class TicketBookRequest(BaseModel):
|
|
seat_id: int
|
|
|
|
class TicketBookResponse(BaseModel):
|
|
ticket_id: int
|
|
payment_url: str
|
|
|
|
class TournamentInfo(BaseModel):
|
|
id: int
|
|
title: str
|
|
event_date: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class SeatInfo(BaseModel):
|
|
id: int
|
|
sector: str
|
|
row: int
|
|
number: int
|
|
price: int
|
|
tournament: TournamentInfo
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class TicketResponse(BaseModel):
|
|
id: int
|
|
status: TicketStatus
|
|
pdf_url: str | None
|
|
created_at: datetime
|
|
seat: SeatInfo
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class TicketScanRequest(BaseModel):
|
|
token: str
|
|
|
|
|
|
class TicketScanResponse(BaseModel):
|
|
success: bool
|
|
message: str
|
|
ticket_id: int | None
|