mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
44 lines
914 B
Python
44 lines
914 B
Python
"""Message / contact-form schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
|
|
class MessageCreate(BaseModel):
|
|
listing_id: str
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
email: EmailStr
|
|
phone: Optional[str] = Field(None, max_length=20)
|
|
message: str = Field(..., min_length=1, max_length=2000)
|
|
|
|
|
|
class MessageResponse(BaseModel):
|
|
id: str
|
|
listing_id: str
|
|
agency_id: str
|
|
name: str
|
|
email: str
|
|
phone: Optional[str] = None
|
|
message: str
|
|
read: bool
|
|
created_at: datetime
|
|
# Joined
|
|
listing_title: Optional[str] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class MessageListResponse(BaseModel):
|
|
messages: list[MessageResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
|
|
|
|
class MessageMarkRead(BaseModel):
|
|
read: bool = True
|