
- 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
601 B
Python
18 lines
601 B
Python
from typing import List, Optional
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.department import Department
|
|
from app.schemas.department import DepartmentCreate, DepartmentUpdate
|
|
|
|
|
|
class CRUDDepartment(CRUDBase[Department, DepartmentCreate, DepartmentUpdate]):
|
|
def get_by_name(self, db: Session, *, name: str) -> Optional[Department]:
|
|
return db.query(Department).filter(Department.name == name).first()
|
|
|
|
def get_all(self, db: Session) -> List[Department]:
|
|
return db.query(Department).all()
|
|
|
|
|
|
department = CRUDDepartment(Department) |