project-6-b7f5rz/schemas/contact_form.py

25 lines
836 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")
email: EmailStr = Field(..., description="Email 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 of the contact")
message: Optional[str] = Field(None, description="Message from the contact")
class ContactFormSchema(ContactFormBase):
id: uuid.UUID
created_at: datetime
updated_at: datetime
class Config:
orm_mode = True