added documentation for employees
This commit is contained in:
parent
cd766e6bbf
commit
0104400dbd
|
|
@ -63,7 +63,7 @@ urlpatterns = [
|
||||||
path('employees/search/', views.EmployeesListSearchViews.as_view(), name='employees-search'),
|
path('employees/search/', views.EmployeesListSearchViews.as_view(), name='employees-search'),
|
||||||
path('employees/<int:pk>/', views.EmployeeRUDView.as_view(), name='employees-rud'),
|
path('employees/<int:pk>/', views.EmployeeRUDView.as_view(), name='employees-rud'),
|
||||||
path('employees/<int:pk>/<int:award_id>', views.RemoveAwardView.as_view(), name='employees-award-delete'),
|
path('employees/<int:pk>/<int:award_id>', views.RemoveAwardView.as_view(), name='employees-award-delete'),
|
||||||
path('<int:establishment_id>/employee/<int:employee_id>/position/<int:position_id>',
|
path('<int:establishment_id>/employee/<int:employee_id>/position/<int:position_id>/',
|
||||||
views.EstablishmentEmployeeCreateView.as_view(),
|
views.EstablishmentEmployeeCreateView.as_view(),
|
||||||
name='employees-establishment-create'),
|
name='employees-establishment-create'),
|
||||||
path('employee/position/<int:pk>/delete/', views.EstablishmentEmployeeDeleteView.as_view(),
|
path('employee/position/<int:pk>/delete/', views.EstablishmentEmployeeDeleteView.as_view(),
|
||||||
|
|
|
||||||
|
|
@ -69,8 +69,28 @@ class EstablishmentListCreateView(EstablishmentMixinViews, generics.ListCreateAP
|
||||||
|
|
||||||
|
|
||||||
class EmployeeEstablishmentPositionsView(generics.ListAPIView):
|
class EmployeeEstablishmentPositionsView(generics.ListAPIView):
|
||||||
"""Establishment by employee view."""
|
"""
|
||||||
|
## Establishment employee positions filtered by employee identifier.
|
||||||
|
### *GET*
|
||||||
|
#### Description
|
||||||
|
Return paginated list of results from an intermediate table filtered by employee
|
||||||
|
identifier, that contains connection between employee establishment,
|
||||||
|
employee hiring dates, position, status `'I' (Idle)`, `'A' (Accepted)`, `'D' (Declined)`.
|
||||||
|
##### Response
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"count": 58,
|
||||||
|
"next": 2,
|
||||||
|
"previous": null,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
...
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
queryset = models.EstablishmentEmployee.objects.all()
|
queryset = models.EstablishmentEmployee.objects.all()
|
||||||
serializer_class = serializers.EstablishmentEmployeePositionsSerializer
|
serializer_class = serializers.EstablishmentEmployeePositionsSerializer
|
||||||
permission_classes = get_permission_classes(
|
permission_classes = get_permission_classes(
|
||||||
|
|
@ -85,7 +105,26 @@ class EmployeeEstablishmentPositionsView(generics.ListAPIView):
|
||||||
|
|
||||||
|
|
||||||
class EmployeeEstablishmentsListView(generics.ListAPIView):
|
class EmployeeEstablishmentsListView(generics.ListAPIView):
|
||||||
"""Establishment by employee list view."""
|
"""
|
||||||
|
## Employee establishments filtered by employee identifier.
|
||||||
|
### *GET*
|
||||||
|
#### Description
|
||||||
|
Return paginated list of establishments filtered by employee identifier.
|
||||||
|
##### Response
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"count": 58,
|
||||||
|
"next": 2,
|
||||||
|
"previous": null,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
...
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
serializer_class = serializers.EstablishmentListCreateSerializer
|
serializer_class = serializers.EstablishmentListCreateSerializer
|
||||||
permission_classes = get_permission_classes(
|
permission_classes = get_permission_classes(
|
||||||
IsEstablishmentManager,
|
IsEstablishmentManager,
|
||||||
|
|
@ -99,8 +138,25 @@ class EmployeeEstablishmentsListView(generics.ListAPIView):
|
||||||
|
|
||||||
|
|
||||||
class EmployeePositionsListView(generics.ListAPIView):
|
class EmployeePositionsListView(generics.ListAPIView):
|
||||||
"""Establishment position by employee list view."""
|
"""
|
||||||
|
## Paginated list of establishments filtered by employee identifier
|
||||||
|
### *GET*
|
||||||
|
#### Description
|
||||||
|
Return a paginated list of establishments of an employee by employee identifier.
|
||||||
|
##### Response
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"count": 2,
|
||||||
|
"next": null,
|
||||||
|
"previous": null,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
queryset = models.Establishment.objects.all()
|
queryset = models.Establishment.objects.all()
|
||||||
serializer_class = serializers.EstablishmentPositionListSerializer
|
serializer_class = serializers.EstablishmentPositionListSerializer
|
||||||
permission_classes = get_permission_classes(
|
permission_classes = get_permission_classes(
|
||||||
|
|
@ -942,6 +998,29 @@ class EstablishmentNoteRUDView(EstablishmentMixinViews,
|
||||||
|
|
||||||
|
|
||||||
class EstablishmentEmployeeCreateView(generics.CreateAPIView):
|
class EstablishmentEmployeeCreateView(generics.CreateAPIView):
|
||||||
|
"""
|
||||||
|
## Create employee position for establishment
|
||||||
|
### *POST*
|
||||||
|
#### Description
|
||||||
|
Creating position for an employee for establishment,
|
||||||
|
by `establishment identifier`, `employee identifier` and
|
||||||
|
`position identifier`.
|
||||||
|
|
||||||
|
##### Request data
|
||||||
|
Available fields:
|
||||||
|
* from_date - datetime (datetime in a format `ISO-8601`), by default `timezone.now()`
|
||||||
|
* to_date - datetime (datetime in a format `ISO-8601`), by default `null`
|
||||||
|
|
||||||
|
##### Response data
|
||||||
|
E.g.:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"id": 47405,
|
||||||
|
"from_date": "2020-02-06T11:01:04.961000Z",
|
||||||
|
"to_date": "2020-02-06T11:01:04.961000Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"""
|
||||||
serializer_class = serializers.EstablishmentEmployeeCreateSerializer
|
serializer_class = serializers.EstablishmentEmployeeCreateSerializer
|
||||||
queryset = models.EstablishmentEmployee.objects.all()
|
queryset = models.EstablishmentEmployee.objects.all()
|
||||||
permission_classes = get_permission_classes(
|
permission_classes = get_permission_classes(
|
||||||
|
|
@ -951,6 +1030,18 @@ class EstablishmentEmployeeCreateView(generics.CreateAPIView):
|
||||||
|
|
||||||
|
|
||||||
class EstablishmentEmployeeDeleteView(generics.DestroyAPIView):
|
class EstablishmentEmployeeDeleteView(generics.DestroyAPIView):
|
||||||
|
"""
|
||||||
|
## Delete employee position for establishment
|
||||||
|
### *DELETE*
|
||||||
|
#### Description
|
||||||
|
Deleting position for an employee from establishment, by `position identifier`.
|
||||||
|
|
||||||
|
|
||||||
|
##### Response data
|
||||||
|
```
|
||||||
|
No content
|
||||||
|
```
|
||||||
|
"""
|
||||||
queryset = EstablishmentEmployee.objects.all()
|
queryset = EstablishmentEmployee.objects.all()
|
||||||
permission_classes = get_permission_classes(
|
permission_classes = get_permission_classes(
|
||||||
IsEstablishmentManager,
|
IsEstablishmentManager,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user