
- Set up project structure with FastAPI framework - Create database models for users, employees, departments, and job titles - Implement JWT authentication and authorization system - Set up SQLite database with SQLAlchemy ORM - Add Alembic migrations for database versioning - Create CRUD API endpoints for employee management - Implement category-based search functionality - Add OpenAPI documentation and health check endpoint - Update README with comprehensive setup and usage instructions
18 lines
574 B
Python
18 lines
574 B
Python
from typing import List, Optional
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.job_title import JobTitle
|
|
from app.schemas.job_title import JobTitleCreate, JobTitleUpdate
|
|
|
|
|
|
class CRUDJobTitle(CRUDBase[JobTitle, JobTitleCreate, JobTitleUpdate]):
|
|
def get_by_title(self, db: Session, *, title: str) -> Optional[JobTitle]:
|
|
return db.query(JobTitle).filter(JobTitle.title == title).first()
|
|
|
|
def get_all(self, db: Session) -> List[JobTitle]:
|
|
return db.query(JobTitle).all()
|
|
|
|
|
|
job_title = CRUDJobTitle(JobTitle) |