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