contact-us-8wou7d/schemas/contactform.py

25 lines
857 B
Python

from pydantic import BaseModel, Field, EmailStr
from typing import Optional
from datetime import datetime
from uuid import UUID
class ContactFormBase(BaseModel):
name: str = Field(..., description="Name of the contact")
email: EmailStr = Field(..., description="Email address of the contact")
message: str = Field(..., description="Message from the contact")
class ContactFormCreate(ContactFormBase):
pass
class ContactFormUpdate(ContactFormBase):
name: Optional[str] = Field(None, description="Name of the contact")
email: Optional[EmailStr] = Field(None, description="Email address of the contact")
message: Optional[str] = Field(None, description="Message from the contact")
class ContactFormSchema(ContactFormBase):
id: UUID
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True