
- 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
38 lines
793 B
Python
38 lines
793 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
|
|
|
|
# Shared properties
|
|
class DepartmentBase(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class DepartmentCreate(DepartmentBase):
|
|
name: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class DepartmentUpdate(DepartmentBase):
|
|
pass
|
|
|
|
|
|
class DepartmentInDBBase(DepartmentBase):
|
|
id: Optional[str] = None
|
|
created_at: Optional[datetime] = None
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Additional properties to return via API
|
|
class Department(DepartmentInDBBase):
|
|
pass
|
|
|
|
|
|
# Additional properties stored in DB
|
|
class DepartmentInDB(DepartmentInDBBase):
|
|
pass |