You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

2 days ago
from rest_framework import viewsets
from .models import Employee, WorkTimeLog, Leave, OvertimeReport, Report
from .serializers import (
EmployeeSerializer, WorkTimeLogSerializer, LeaveSerializer,
OvertimeReportSerializer, ReportSerializer
)
# ViewSet для модели Employee
class EmployeeViewSet(viewsets.ModelViewSet):
queryset = Employee.objects.all()
serializer_class = EmployeeSerializer
# ViewSet для модели WorkTimeLog
class WorkTimeLogViewSet(viewsets.ModelViewSet):
queryset = WorkTimeLog.objects.all()
serializer_class = WorkTimeLogSerializer
# ViewSet для модели Leave
class LeaveViewSet(viewsets.ModelViewSet):
queryset = Leave.objects.all()
serializer_class = LeaveSerializer
# ViewSet для модели OvertimeReport
class OvertimeReportViewSet(viewsets.ModelViewSet):
queryset = OvertimeReport.objects.all()
serializer_class = OvertimeReportSerializer
# ViewSet для модели Report
class ReportViewSet(viewsets.ModelViewSet):
queryset = Report.objects.all()
serializer_class = ReportSerializer