Automated Action 1b9ddb4750 Implement comprehensive HR Management Backend System
- 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
2025-06-23 10:06:23 +00:00

39 lines
1.2 KiB
Python

from pydantic import BaseModel
from typing import Optional
from datetime import datetime, date
from decimal import Decimal
from app.models.payroll import PayrollStatus
class PayrollRecordBase(BaseModel):
employee_id: int
pay_period_start: date
pay_period_end: date
base_salary: Decimal
overtime_hours: Optional[Decimal] = Decimal('0')
overtime_rate: Optional[Decimal] = Decimal('0')
bonus: Optional[Decimal] = Decimal('0')
deductions: Optional[Decimal] = Decimal('0')
tax_deductions: Optional[Decimal] = Decimal('0')
class PayrollRecordCreate(PayrollRecordBase):
pass
class PayrollRecordUpdate(BaseModel):
overtime_hours: Optional[Decimal] = None
overtime_rate: Optional[Decimal] = None
bonus: Optional[Decimal] = None
deductions: Optional[Decimal] = None
tax_deductions: Optional[Decimal] = None
class PayrollRecord(PayrollRecordBase):
id: int
gross_pay: Decimal
net_pay: Decimal
status: PayrollStatus
processed_by: Optional[int] = None
processed_at: Optional[datetime] = None
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True