|
|
|
from django.urls import path, include
|
|
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .views import (
|
|
|
|
ProductViewSet, EmployeeViewSet, PositionViewSet,
|
|
|
|
StorageLocationViewSet, ContractorViewSet, SupplyContractViewSet, TruckViewSet
|
|
|
|
)
|
|
|
|
from drf_yasg.views import get_schema_view
|
|
|
|
from drf_yasg import openapi
|
|
|
|
from rest_framework.permissions import AllowAny
|
|
|
|
|
|
|
|
router = DefaultRouter()
|
|
|
|
router.register(r'products', ProductViewSet)
|
|
|
|
router.register(r'employees', EmployeeViewSet)
|
|
|
|
router.register(r'positions', PositionViewSet)
|
|
|
|
router.register(r'storage-locations', StorageLocationViewSet)
|
|
|
|
router.register(r'contractors', ContractorViewSet)
|
|
|
|
router.register(r'supply-contracts', SupplyContractViewSet)
|
|
|
|
router.register(r'trucks', TruckViewSet)
|
|
|
|
|
|
|
|
schema_view = get_schema_view(
|
|
|
|
openapi.Info(
|
|
|
|
title="Store Management API",
|
|
|
|
default_version='v1',
|
|
|
|
description="API for managing the franchise store",
|
|
|
|
terms_of_service="https://www.example.com/terms/",
|
|
|
|
contact=openapi.Contact(email="support@example.com"),
|
|
|
|
license=openapi.License(name="BSD License"),
|
|
|
|
),
|
|
|
|
public=True,
|
|
|
|
permission_classes=(AllowAny,),
|
|
|
|
)
|
|
|
|
|
|
|
|
urlpatterns = [
|
|
|
|
path('api/', include(router.urls)),
|
|
|
|
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
|
|
|
path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
|
|
|
|
]
|