Skip to content

Commit

Permalink
feat(api): Add API v2 Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Oct 12, 2024
1 parent c1ceaae commit 745ea55
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
from .views.itam import inventory


from api.viewsets import index as v2


app_name = "API"


Expand Down Expand Up @@ -64,6 +67,8 @@
router.register('software', software.SoftwareViewSet, basename='software')


# API V2
router.register('v2', v2.Index, basename='_api_v2_home')

urlpatterns = [

Expand Down
37 changes: 37 additions & 0 deletions app/api/viewsets/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from drf_spectacular.utils import extend_schema

from rest_framework.response import Response
from rest_framework.reverse import reverse

from api.viewsets.common import CommonViewSet



@extend_schema(exclude = True)
class Index(CommonViewSet):

allowed_methods: list = [
'GET',
'HEAD',
'OPTIONS'
]

view_description = """Centurion ERP API V2.
This endpoint will move to path `/api/` on release of
v2.0.0 of Centurion ERP.
"""

view_name = "API v2"


def list(self, request, *args, **kwargs):

return Response(
{
"access": "to do",
"assistance": reverse('API:_api_v2_assistance_home-list', request=request),
"itam": reverse('API:_api_v2_itam_home-list', request=request),
"settings": reverse('API:_api_v2_settings_home-list', request=request)
}
)

0 comments on commit 745ea55

Please sign in to comment.