
- Set up project structure with FastAPI application - Implement SQLAlchemy models for users, services, projects, team members, contacts - Create API endpoints for website functionality - Implement JWT authentication system with user roles - Add file upload functionality for media - Configure CORS and health check endpoints - Add database migrations with Alembic - Create comprehensive README with setup instructions
43 lines
926 B
Python
43 lines
926 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr, Field
|
|
|
|
|
|
# Shared properties
|
|
class ContactBase(BaseModel):
|
|
name: Optional[str] = None
|
|
email: Optional[EmailStr] = None
|
|
phone: Optional[str] = None
|
|
subject: Optional[str] = None
|
|
message: Optional[str] = None
|
|
is_read: Optional[bool] = False
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class ContactCreate(ContactBase):
|
|
name: str = Field(..., min_length=1, max_length=100)
|
|
email: EmailStr
|
|
message: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class ContactUpdate(ContactBase):
|
|
pass
|
|
|
|
|
|
class ContactInDBBase(ContactBase):
|
|
id: int
|
|
name: str
|
|
email: EmailStr
|
|
message: str
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Contact(ContactInDBBase):
|
|
pass |