27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
from pydantic import BaseModel, Field, EmailStr
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
import uuid
|
|
|
|
class ContactFormBase(BaseModel):
|
|
name: str = Field(..., min_length=1, description="Name of the person submitting the form")
|
|
email: EmailStr = Field(..., description="Email address of the person submitting the form")
|
|
subject: str = Field(..., min_length=1, description="Subject of the contact form")
|
|
message: str = Field(..., min_length=1, description="Message content of the contact form")
|
|
|
|
class ContactFormCreate(ContactFormBase):
|
|
pass
|
|
|
|
class ContactFormUpdate(ContactFormBase):
|
|
name: Optional[str] = Field(None, min_length=1, description="Name of the person submitting the form")
|
|
email: Optional[EmailStr] = Field(None, description="Email address of the person submitting the form")
|
|
subject: Optional[str] = Field(None, min_length=1, description="Subject of the contact form")
|
|
message: Optional[str] = Field(None, min_length=1, description="Message content of the contact form")
|
|
|
|
class ContactFormSchema(ContactFormBase):
|
|
id: uuid.UUID
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True |