Initial commit

This commit is contained in:
Andre Beging
2025-10-07 12:51:31 +02:00
commit c7f694d820
18 changed files with 1683 additions and 0 deletions

58
app/models.py Normal file
View File

@@ -0,0 +1,58 @@
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class HookCreate(BaseModel):
message: str = Field(..., min_length=1, description="Message body supporting Markdown")
chat_id: str = Field(..., min_length=1, description="Target chat ID or username")
class HookRead(BaseModel):
hook_id: str
message: str
chat_id: str
created_at: datetime
@property
def action_path(self) -> str:
return f"/action/{self.hook_id}"
class HookResponse(HookRead):
action_url: str
class HookUpdateId(BaseModel):
hook_id: str = Field(
...,
min_length=3,
max_length=64,
pattern=r"^[A-Za-z0-9_-]+$",
description="New hook identifier",
)
class LoginStartRequest(BaseModel):
phone_number: Optional[str] = None
class LoginVerifyRequest(BaseModel):
code: str
phone_number: Optional[str] = None
password: Optional[str] = None
class MessageTriggerResponse(BaseModel):
status: str
hook_id: str
chat_id: str
class StatusResponse(BaseModel):
authorized: bool
user: Optional[str]
session_active: bool
phone_number: Optional[str]
code_sent: bool = False