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

38 lines
1.0 KiB
Python

from pydantic import BaseModel
from typing import Optional
from datetime import datetime, date
from app.models.leaves import LeaveType, LeaveStatus
class LeaveRequestBase(BaseModel):
leave_type: LeaveType
start_date: date
end_date: date
days_requested: int
reason: Optional[str] = None
class LeaveRequestCreate(LeaveRequestBase):
employee_id: int
class LeaveRequestUpdate(BaseModel):
leave_type: Optional[LeaveType] = None
start_date: Optional[date] = None
end_date: Optional[date] = None
days_requested: Optional[int] = None
reason: Optional[str] = None
class LeaveRequestApproval(BaseModel):
status: LeaveStatus
comments: Optional[str] = None
class LeaveRequest(LeaveRequestBase):
id: int
employee_id: int
status: LeaveStatus
approved_by: Optional[int] = None
approved_at: Optional[datetime] = None
comments: Optional[str] = None
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True