mybuddy/api/urls.py

50 lines
1.5 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2022-08-25 08:15:09 +00:00
from typing import NamedTuple, Optional, Any
from django.urls import include, path
from rest_framework import routers
from rest_framework.schemas import get_schema_view
2017-11-10 02:15:09 +00:00
from . import views
router = routers.DefaultRouter()
2022-05-27 22:39:25 +00:00
router.register(r"bmi", views.BMIViewSet)
2022-02-10 00:00:30 +00:00
router.register(r"changes", views.DiaperChangeViewSet)
2022-05-27 22:39:25 +00:00
router.register(r"children", views.ChildViewSet)
2022-02-10 00:00:30 +00:00
router.register(r"feedings", views.FeedingViewSet)
2022-05-27 22:39:25 +00:00
router.register(r"head-circumference", views.HeadCircumferenceViewSet)
router.register(r"height", views.HeightViewSet)
2022-02-10 00:00:30 +00:00
router.register(r"notes", views.NoteViewSet)
2022-03-04 15:39:13 +00:00
router.register(r"pumping", views.PumpingViewSet)
2022-05-27 22:39:25 +00:00
router.register(r"sleep", views.SleepViewSet)
router.register(r"tags", views.TagViewSet)
router.register(r"temperature", views.TemperatureViewSet)
2022-02-10 00:00:30 +00:00
router.register(r"timers", views.TimerViewSet)
router.register(r"tummy-times", views.TummyTimeViewSet)
router.register(r"weight", views.WeightViewSet)
2022-08-25 08:15:09 +00:00
class ExtraUrl(NamedTuple):
view: Any
name: Optional[str] = None
2017-12-03 21:52:27 +00:00
2022-08-25 08:15:09 +00:00
extra_api_urls = [
path("api/profile", views.ProfileView.as_view()),
2022-02-10 00:00:30 +00:00
path(
2022-08-25 08:15:09 +00:00
"api/schema",
2022-02-10 00:00:30 +00:00
get_schema_view(
title="Baby Buddy API",
version=1,
description="API documentation for the Baby Buddy application",
),
name="openapi-schema",
),
]
2022-08-25 08:15:09 +00:00
app_name = "api"
urlpatterns = [
path("api/", include(router.urls + list(extra_api_urls))),
path("api/auth/", include("rest_framework.urls", namespace="rest_framework")),
] + extra_api_urls