
- FastAPI application with JWT authentication and role-based access control - Complete employee management with CRUD operations - Department management with manager assignments - Leave management system with approval workflow - Payroll processing with overtime and deductions calculation - Attendance tracking with clock in/out functionality - SQLite database with proper migrations using Alembic - Role-based permissions (Admin, HR Manager, Manager, Employee) - Comprehensive API documentation and health checks - CORS enabled for cross-origin requests Environment Variables Required: - SECRET_KEY: JWT secret key for token signing Features implemented: - User registration and authentication - Employee profile management - Department hierarchy management - Leave request creation and approval - Payroll record processing - Daily attendance tracking - Hours calculation for attendance - Proper error handling and validation
24 lines
571 B
Python
24 lines
571 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class DepartmentBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
manager_id: Optional[int] = None
|
|
|
|
class DepartmentCreate(DepartmentBase):
|
|
pass
|
|
|
|
class DepartmentUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
manager_id: Optional[int] = None
|
|
|
|
class Department(DepartmentBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True |