♻️(backend) refactor post hackathon to a first working version

This project was copied and hacked to make a POC in a 2-day hackathon.
We need to clean and refactor things in order to get a first version
of the product we want.
This commit is contained in:
Samuel Paccoud - DINUM
2024-02-09 19:32:12 +01:00
committed by Samuel Paccoud
parent 0a3e26486e
commit 0f9327a1de
41 changed files with 2259 additions and 2567 deletions

View File

@@ -1,10 +1,36 @@
"""URL configuration for the core app."""
from django.urls import path
from django.conf import settings
from django.urls import include, path, re_path
from rest_framework.routers import DefaultRouter
from core.api import viewsets
# - Main endpoints
router = DefaultRouter()
router.register("templates", viewsets.TemplateViewSet, basename="templates")
router.register("users", viewsets.UserViewSet, basename="users")
# - Routes nested under a template
template_related_router = DefaultRouter()
template_related_router.register(
"accesses",
viewsets.TemplateAccessViewSet,
basename="template_accesses",
)
from core.views import generate_document, TemplatesApiView, GenerateDocumentAPIView
urlpatterns = [
path('generate-document/', generate_document, name='generate_document'),
path('api/generate-document/', GenerateDocumentAPIView.as_view(), name='generate-document'),
path('api/templates', TemplatesApiView.as_view()),
path(
f"api/{settings.API_VERSION}/",
include(
[
*router.urls,
re_path(
r"^templates/(?P<template_id>[0-9a-z-]*)/",
include(template_related_router.urls),
),
]
),
),
]