swag-shop/backend/app/schemas/shop_schemas.py

28 lines
831 B
Python

from datetime import datetime
from pydantic import EmailStr, BaseModel, Field
from sqlmodel import SQLModel
from app.database.models.shop_model import ShopAddress, ShopStatus, ShopBusinessHours, ShopLinks
class ShopCreate(BaseModel):
name: str = Field(max_length=100, nullable=False, unique=True)
description: str = Field(max_length=500, nullable=False)
currency: str = Field(max_length=3, nullable=False)
contact_email: EmailStr = Field()
contact_phone_number: str = Field(min_length=2, max_length=16, pattern=r'^\+[1-9]\d{1,14}$')
address: ShopAddress
class ShopPublic(BaseModel):
name: str
description: str
currency: str
contact_email: EmailStr
contact_phone_number: str
address: ShopAddress
business_hours: ShopBusinessHours
links: ShopLinks
status: ShopStatus