25 lines
889 B
Python
25 lines
889 B
Python
from pydantic import BaseModel, Field, EmailStr
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
|
|
class ContactFormBase(BaseModel):
|
|
name: str = Field(..., description="Contact form submitter's name")
|
|
email: EmailStr = Field(..., description="Contact form submitter's email address")
|
|
message: str = Field(..., description="Contact form message")
|
|
|
|
class ContactFormCreate(ContactFormBase):
|
|
pass
|
|
|
|
class ContactFormUpdate(ContactFormBase):
|
|
name: Optional[str] = Field(None, description="Contact form submitter's name")
|
|
email: Optional[EmailStr] = Field(None, description="Contact form submitter's email address")
|
|
message: Optional[str] = Field(None, description="Contact form message")
|
|
|
|
class ContactFormSchema(ContactFormBase):
|
|
id: UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |