
- 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
19 lines
531 B
Python
19 lines
531 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.contact import Contact
|
|
from app.schemas.contact import ContactCreate, ContactUpdate
|
|
|
|
|
|
class CRUDContact(CRUDBase[Contact, ContactCreate, ContactUpdate]):
|
|
def mark_as_read(self, db: Session, *, id: int) -> Contact:
|
|
db_obj = self.get(db, id=id)
|
|
if db_obj:
|
|
db_obj.is_read = True
|
|
db.add(db_obj)
|
|
db.commit()
|
|
db.refresh(db_obj)
|
|
return db_obj
|
|
|
|
|
|
contact = CRUDContact(Contact) |